anonymous
  • anonymous
JAVA composition class? help me =(
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
its not the full gui output example but i hope you get the idea, where do i start?? can someone solve this
anonymous
  • anonymous
1) Given the class descriptions and UML diagram below, develop and write the java codes for the classes “PhdStudents.java” and “QualifyingExams.java”, as well as the application program, “PhdQualifyingExam.java”. 2) Run the application program to generate the same given outputs in the four different cases. PhdStudents QualifyingExams 1 0..2 PhdStudents Class The class records each Ph.D. student’s name, GPA, and G#Number. The name entered cannot be blank, the GPA must be between 0 and 4, and the G#Number must be the format of e.g., “G00524802”. Each Ph.D. student needs to take a set of qualifying exams that describes in the QualifyingExams class. Each Ph.D. student cannot take the qualifying exams more than twice. The passing score of each exam in a set of the qualifying exams is 50. The class contains two overloaded constructors. The argument constructor accepts and assigns the G#Number, name, and GPA to the instance variables and then calls a no-arg constructor that creates an array of qualifying exams. The class also has a method to return the status whether or not the student passes the qualifying exams, and a toString( ) method that returns the student’s name, G#Number, and the exams and scores that the student passes the set of qualifying exams if the student passes four of exam topics in the set. A student passes the qualifying exams if he or she gets at least 50 points in every one of the four exam topics. You can define other attributes and setter/getter methods in the class if necessary. QualifyingExams Class Each set of qualifying exams has four exam topics and the corresponding scores. The exam topic entered cannot be blank, and the exam score must be between 0 and 100. You can define other attributes and setter/getter methods in the class if necessary. ` PhdQualifyingExam Class The class has two sub-methods. One is to create a Ph.D. student with the exam titles and scores and return the student back to the main( ). This sub-method allows the user to input the title and score for each exam topic and asks the user to re-enter again if at least one of the exam data is not valid. The method displays the greeting message if the qualifying exams are passed or otherwise. It also asks the user whether or not he or she wants to re-take another set of qualifying exams in the second time if he or she fails the first time. Another method is to display the student contents, which include the name, the G#Number, and the score for each exam topic if he or she passes the set of the four exam topics. If not, display
anonymous
  • anonymous
1 Attachment

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
uml diagram above ^
eSpeX
  • eSpeX
Where to start is to look at the uml diagram. The composition indicator means that the exams cannot exist without the students. Next you look at what the students class consists of, make a list of all the instance variables and build the methods necessary to set/get each of those. As you build the student class it should become apparent where you will need to expand into the exam class, start the same way on that class with the instance variables and basic methods.
anonymous
  • anonymous
thanks I'm gonna give it a go
anonymous
  • anonymous
but how do you implement composition into code? that's what i don't really understand
eSpeX
  • eSpeX
Composition is more about how the code is implemented than it's functionality.
eSpeX
  • eSpeX
The idea behind composition is that without one thing you cannot have another.
anonymous
  • anonymous
Composition is usually contrasted with inheritance as a design choice of how to organize your classes in object-oriented systems. So to extend a class with some functionality you could subclass it, e. g. one class is "Student" and a subclass is "PhdStudent", which inherits most of what students does. Or "Student" could use composition, by adding a member "type" or "goal" (these are only rough examples to get the idea across) which points to e. g. an interface (in Java) Type, with e. g. implementing classes such as PhdType, UndergraduateType, etc. In UML, composition (the filled-in diamond) implies that when the (single; when can be several, UML calls the relationship "containment" object that points (Student in my example) gets deleted, the pointed-to object disappears too (what eSpeX already said). Not necessarily the case in my example (which would be an example of aggregation, which in UML is shown by an empty diamond). So in Java, a (UML) composition relationship is implemented simply by having one class have the other class as a member. public class Car { private Engine engine; } The car "has-a[n]" engine. composition In Java you cannot easily distinguish between composition and aggregation (because in principle that engine could be used by other cars. There are ways around this but they are probably out of scope here). In other languages you can. http://ootips.org/uml-hasa.html

Looking for something else?

Not the answer you are looking for? Search for more explanations.