• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Set Operations

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi~~
From Input.Txt file to read
input.txt Content
A{1,2,3,4,5}
B{32,34,56,78}
C{12,3,4,5,}
user keyboard input (A-B)*C Or((A*B)-c)+b
+(||),-(&&),*(difference)

Thanks
 
Marshal
Posts: 76862
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch

There is nothing like a nice short question, but that one is maybe too short!

Do you mean, how do you do set operations like intersection difference and union? Go to the Java Tutorials, and you can read about the collections framework, which includes sets. There is an interface called Set, and it tells you which method represents union, intersection, etc. You can then call the same method on a class which implements the Set interface; HashSet is probably the most popular. For some versions of set difference you may have to do the procedure in several stages.

Good luck with it
 
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a nice homework problem, however we suggest you Do Your Own Homework (FAQ).

Aside:
I've always thought professors would be better off giving early program assignments with code that performs the I/O already and input test files, so that new programmers can see some code and learn from it, and modify the code to do the crux of the work. Later in the term they can get the I/O part dumped on them.

Get some of it going, and if you have particular questions about your code as us.
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic