A+ Answers



Question 1
Based on the data definition class identified below, which of the following statements shows the correct way to represent the instance variable, name, within a UML class diagram?
(+) String : name
(+) name : String
None of the other answers are correct.
(-) String : name
(-) name : String
Question 2
Using the data definition class and implementation class identified below, assume the following code is added after Line 5 in the implementation class:
JOptionPane.showMessageDialog(null, aTextbook.wholesaleCost);
Based on the addition of this line of code, which of the following will occur when attempting to compile and run the code?
The code will compile, but cause a runtime error because the value of the wholesaleCost attribute has not been set.
None of the other answers are correct.
The code will compile and output 0.0.
The code will fail to compile.
The code will compile, but cause a logic error when running it because the value of the wholesaleCost attribute has not been set.
Question 3
Based on the data definition class and implementation class identified below, which of the following statements is legal/allowed to be added into implementation class after Line 5?
double cost = purchaseCost();
JOptionPane.showMessageDialog(null, “The textbook name is: ” + name);
aTextbook.setName(“Big Java”);
aTextbook.name = “Big Java”;
None of the other answers are correct.
Based on the data definition class identified below, which of the following statements shows the correct way to represent the method signature for setWholesaleCost within a UML class diagram?
(-) setWholesaleCost (boolean) : wholesaleCost : double
(+) setWholesaleCost (wholesaleCost : double)
None of the other answers are correct.
(+) setWholesaleCost (boolean) wholesaleCost : double
(-) setWholesaleCost (wholesaleCost : double) : boolean
Question 5
Working at the GMU Used Car Dealership, you need to create an object-oriented application to handle inventory. To start, you create a detailed UML diagram that helps to plan your solution. Based on the detailed UML diagram below, translate the class definition into a .java file, making sure it compiles.
You do not need to create an implementation class.
Your code must compile using the jGrasp IDE. If your code does not compile using jGrasp (for any reason), a grade of 0 will be earned. No exceptions!