Design a UML class diagram for the following code snippet. Attach your diagram using Add File...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Design a UML class diagram for the following code snippet. Attach your diagram using "Add File" button. Hint: consider reviewing the similar class example, if you have difficulty understanding what is asked. interface I { \\Some Code } abstract class A implements I { } DO] d; class B extends A { \\Some Code } class C extends A { D d; } class D { С[] с } Question 2 (10 points) Write the Java code to implement the following class diagram. You do not need to implement the method bodies. Write all your codes in a SINGLE file and attach ".java" file using "Add File" button. DO NOT attach multiple files. AccountHolder Account -holder #accounts -balance: double = 0.0 #ID: int #address: String 1 1..* +deposit(amt: double) +nextID(): int IndividualHolder -name: String -SSN: String CorporateHolder -contact: String Paragraph < B I U A 川 QL > +withdraw(amt: double) +getBalance(): double + v 7 8 9 10 } 11 12 13 1 public class Student { private String name; private int year; 123456 private Set<String> courses; public Student(String name, int year) { this.name = name; this.year = year; this.courses = new LinkedHashSet<String>(); public void addCourse(String name) { courses.add(name); 14 } 15 16 17 public void dropAll() { courses.clear(); 18 } 19 20 21 public int getCourseCount() { return courses.size(); 22 } 23 24 25 public String getName() { return name; 26 } 27 28 public double getTuition() { 29 return 1450 * courses.size(); 30 } 31 32 33 public int getYear() { return year; 34 } 35 } новос they are not allowed to add a course beyond this limit. - If a graduate student takes no courses or 1 course, they pay a flat tuition of \$1000, but if take more course, they tuition rate per course is twice as much as an undergraduate student. - A burnt-out graduate student is one who is in 4th year or higher (year 8 or higher in overall higher educations) OR who enrolled in 5 or more courses in a year. You must use/override the methods in superclass as well as the below added behaviors: GradStudent(String name, int year, String advisor): Construct a graduate student. Hint: use super() keyword. String getAdvisor(): Returns this grad student's research advisor. boolean isBurntOut(): Returns true if a grad student is burnt-out. Important: The majority of your grade comes from implementing the correct behavior. Part of your grade also comes from appropriately utilizing the behavior you have inherited from the superclass and not re-implementing behavior that already works properly in the superclass. How to submit: Attach your GradStudent class as a ".java" file using "Add File" button. Do NOT add the given student class in your submitted file. Q Question 12 (20 points) Consider the following simplified description of a university where professors teach seminars in which students can enroll. A professor has a name, address, phone number, email address, and salary. A student has also a name, etc., but no salary. A student, however, has an average mark (of the final marks of his or her seminars). A seminar has a name and a number. When a student is enrolled in a seminar, the marks for this enrollment are recorded and the current average as well as the final mark (if there is one) can be obtained from the enrollment. From a student one can obtain a list of seminars he or she is enrolled in. Professors teach seminars. Each seminar has at least one and at most three teachers. There are two types of seminar: bachelor and master. From a bachelor seminar students can not withdraw. From a master seminar they can. Draw a class diagram for this university. Add attributes and methods when necessary. You do not have to include getters and setters for attributes. Motivate your decisions. (Meaning you must explain the decision you made ex. Why you created a specific class / relationship / cardinality/...) Important: Missing motivation, Missing features (methods, attributes), syntactic and Semantic errors will be penalized. Attach your diagram using "Add file" button and write your motivation in the text box below Q L Question 8 (10 points) Explain briefly the difference between these two elements of a UML class diagram: "aggregation" and "composition". Provide also an example of ONE small UML class diagram including all aggregation, composition and generalization relationships. Do not use any examples from the lecture slides. Make sure that the diagram is for one connected meaningful system, NOT 3 separate diagrams for each relationship. Please attach the diagram (only image file) using "Add File" button. Paragraph く B 1 U₁ > Q A/ 叩く描く ов 80 + v > This class represents an undergraduate student at DePaul University. The Year field can show the number of years the student has been enrolled in the academic program. This class also includes the following members: addCourse(String name): Adds a course to the list of courses in the current year. dropAll(): Removes all courses. getCourseCount(): Returns the number of courses in current year. getName(): Returns the name. getTuition(): Returns the amount of paid tuition in the current year which is 1450 the number of courses. getYear(): Returns overall student's year in the higher educations. You must define a new GradStudent class that inherits the Student class with modified behaviors in order to represent a Graduate Student as described below: - Each graduate student is assigned a professor as the research advisor. - Graduate students are 4 years ahead of an undergraduate student which means, for example, a first year graduate student is actually in year 5 of his/her overall years in higher educations. - A graduate student can enroll only in maximum 6 courses each year. Therefore, they are not allowed to add a course beyond this limit. - If a graduate student takes no courses or 1 course, they pay a flat tuition of Q LOC Design a UML class diagram for the following code snippet. Attach your diagram using "Add File" button. Hint: consider reviewing the similar class example, if you have difficulty understanding what is asked. interface I { \\Some Code } abstract class A implements I { } DO] d; class B extends A { \\Some Code } class C extends A { D d; } class D { С[] с } Question 2 (10 points) Write the Java code to implement the following class diagram. You do not need to implement the method bodies. Write all your codes in a SINGLE file and attach ".java" file using "Add File" button. DO NOT attach multiple files. AccountHolder Account -holder #accounts -balance: double = 0.0 #ID: int #address: String 1 1..* +deposit(amt: double) +nextID(): int IndividualHolder -name: String -SSN: String CorporateHolder -contact: String Paragraph < B I U A 川 QL > +withdraw(amt: double) +getBalance(): double + v 7 8 9 10 } 11 12 13 1 public class Student { private String name; private int year; 123456 private Set<String> courses; public Student(String name, int year) { this.name = name; this.year = year; this.courses = new LinkedHashSet<String>(); public void addCourse(String name) { courses.add(name); 14 } 15 16 17 public void dropAll() { courses.clear(); 18 } 19 20 21 public int getCourseCount() { return courses.size(); 22 } 23 24 25 public String getName() { return name; 26 } 27 28 public double getTuition() { 29 return 1450 * courses.size(); 30 } 31 32 33 public int getYear() { return year; 34 } 35 } новос they are not allowed to add a course beyond this limit. - If a graduate student takes no courses or 1 course, they pay a flat tuition of \$1000, but if take more course, they tuition rate per course is twice as much as an undergraduate student. - A burnt-out graduate student is one who is in 4th year or higher (year 8 or higher in overall higher educations) OR who enrolled in 5 or more courses in a year. You must use/override the methods in superclass as well as the below added behaviors: GradStudent(String name, int year, String advisor): Construct a graduate student. Hint: use super() keyword. String getAdvisor(): Returns this grad student's research advisor. boolean isBurntOut(): Returns true if a grad student is burnt-out. Important: The majority of your grade comes from implementing the correct behavior. Part of your grade also comes from appropriately utilizing the behavior you have inherited from the superclass and not re-implementing behavior that already works properly in the superclass. How to submit: Attach your GradStudent class as a ".java" file using "Add File" button. Do NOT add the given student class in your submitted file. Q Question 12 (20 points) Consider the following simplified description of a university where professors teach seminars in which students can enroll. A professor has a name, address, phone number, email address, and salary. A student has also a name, etc., but no salary. A student, however, has an average mark (of the final marks of his or her seminars). A seminar has a name and a number. When a student is enrolled in a seminar, the marks for this enrollment are recorded and the current average as well as the final mark (if there is one) can be obtained from the enrollment. From a student one can obtain a list of seminars he or she is enrolled in. Professors teach seminars. Each seminar has at least one and at most three teachers. There are two types of seminar: bachelor and master. From a bachelor seminar students can not withdraw. From a master seminar they can. Draw a class diagram for this university. Add attributes and methods when necessary. You do not have to include getters and setters for attributes. Motivate your decisions. (Meaning you must explain the decision you made ex. Why you created a specific class / relationship / cardinality/...) Important: Missing motivation, Missing features (methods, attributes), syntactic and Semantic errors will be penalized. Attach your diagram using "Add file" button and write your motivation in the text box below Q L Question 8 (10 points) Explain briefly the difference between these two elements of a UML class diagram: "aggregation" and "composition". Provide also an example of ONE small UML class diagram including all aggregation, composition and generalization relationships. Do not use any examples from the lecture slides. Make sure that the diagram is for one connected meaningful system, NOT 3 separate diagrams for each relationship. Please attach the diagram (only image file) using "Add File" button. Paragraph く B 1 U₁ > Q A/ 叩く描く ов 80 + v > This class represents an undergraduate student at DePaul University. The Year field can show the number of years the student has been enrolled in the academic program. This class also includes the following members: addCourse(String name): Adds a course to the list of courses in the current year. dropAll(): Removes all courses. getCourseCount(): Returns the number of courses in current year. getName(): Returns the name. getTuition(): Returns the amount of paid tuition in the current year which is 1450 the number of courses. getYear(): Returns overall student's year in the higher educations. You must define a new GradStudent class that inherits the Student class with modified behaviors in order to represent a Graduate Student as described below: - Each graduate student is assigned a professor as the research advisor. - Graduate students are 4 years ahead of an undergraduate student which means, for example, a first year graduate student is actually in year 5 of his/her overall years in higher educations. - A graduate student can enroll only in maximum 6 courses each year. Therefore, they are not allowed to add a course beyond this limit. - If a graduate student takes no courses or 1 course, they pay a flat tuition of Q LOC
Expert Answer:
Answer rating: 100% (QA)
Ill provide the UML class diagrams for each of the scenarios youve presented along with explanations ... View the full answer
Related Book For
Introduction To Programming With Java A Problem Solving Approach
ISBN: 9781260575248
3rd International Edition
Authors: John Dean
Posted Date:
Students also viewed these programming questions
-
If f(x) = (x a)(x b)(x c), show that f'(x) f(x) 1 1 1 x - a x - b x - c
-
123 Compare the purely graphical properties of these two notations, and the ways in which the graphical properties of each display correspond to the information structure being defined. Describe...
-
In its income statement for the year ended December 31, 2020, Bramble Company reported the following condensed data. Operating expenses $754,570 Interest revenue $28,440 Cost of goods sold 1,339,800...
-
Two equally competent and equally educated expert witnesses who have the same information and documents should arrive at about the same amount of estimated damages in a particular dispute most of the...
-
The figure shows a rectangle inscribed in an isosceles right triangle whose hypotenuse is 2 units long. a. Express the y-coordinate of P in terms of x. b. Express the area of the rectangle in terms...
-
Crush Autosmashers can purchase a new electromagnet for moving cars at a cost of \($20,000.\) At the end of its useful life, the electromagnet will be worth \($1,000.\) If Crushs MARR is 12...
-
At the Department of Motor Vehicles (DMV) the process of getting license plates for your car begins when you enter the facility and take a number. You walk 50 feet to the waiting area. During your...
-
An Olympic lifter (m =103kg) is holding a lift with a mass of 350 kg. The bar exerts a purely vertical force that is equally distributed between both hands. Each arm has a mass of 9 kg, are 0.8m long...
-
Sofia Lofts case, but under a new set of assumptions on page 11 of the case. First re-read the Sofia Lofts case, then click here to download the new page 11. Specifically, you are to write up a brief...
-
relevant for improving your professional practice. You may need to conduct extra research for this question, and if you do: Write the information in your own words Reference your sources Legal or...
-
Calculation and discussion of the five-day 1%-Value at Risk (99% confidence level) of your portfolio using model- building approach. Show key steps of workings. (3 marks) Calculation and discussion...
-
Calculate the simple average weighted return per fund on the initial allocation within the portfolio and comment as to why the portfolio return (calculated in #2) is different than the sum of the...
-
Create a GUI that pops up ONLY if the car is selected. This new window should contain JLabels with JTextFields that allow the user to enter in all the car's relevant information - e.g. Make, Model,...
-
Show a GUI calculator program that will offer the user a button to clear the values, buttons for all digits 0 through 9, as well as the operator buttons for multiplication, division, addition,...
-
method ology and Technical Path of "Structual changes in the EU - China Trade --- the impacts of the COVID-19 Pandemic." Create the model which is based on the theory of comparative advantage....
-
A baseball player with a batting average of 0.25 has 12 officials at-bats in a three-game series. What is the mean and standard deviation of his batting probability?
-
Discuss the concept of the looking-glass self. how do you think others perceive you? do you think most people perceive you correctly?
-
Consider the following program: Mark all of the lines of code that have a compilation error. For each compilation-error line, explain why it is incorrect. For each compilation error, just provide the...
-
How many distinct characters are identified by the basic ASCII character set?
-
Is it possible for a while loop to have an infinite number of iterations?
-
In a(n)________ numbering system, all numeric values are written as sequences of 0s and 1s. a. hexadecimal b. binary c. octal d. decimal
-
What is a program?
-
List the five major components of a computer system.
Study smarter with the SolutionInn App