Laboratory Exercise Classes and Methods Computer Programming 2 Answer

Published: 17 December 2022
on channel: Games with Brian
2,950
23

Answer for this laboratory exercise
https://elms.sti.edu/files/3056044/02...

You can see the answer code here: https://github.com/Brian-Serrano?tab=...

Transcribed Text
Laboratory Exercise
Classes and Methods
Objective:
At the end of the exercise, the students should be able to:
 Create a program based on a UML Class Diagram.
Software Requirements:
 Latest version of Netbeans
 Java Development Kit (JDK) 8
Procedure:
1. Create a folder named LastName_FirstName (ex. Reyes_Mark) in your local drive.
2. Create a project named LabExer2. Set the project location to your own folder.
3. Construct a simple purchasing program based on the UML Class Diagram below.
LabExer2
itemName: String
itemPrice: double
itemQuantity: int
amountDue: double
setItemName(String newItemName): void
setTotalCost (int quantity, double price): void
getItemName(): String
getTotalCost(): double
readInput(): void
writeOutput(): void
Note: The readInput() method will be used to accept user input through the Scanner class. This is
done by:
a. Writing import java.util.*; on top of the code, before the line for the class name
b. Instantiating an object of the Scanner class, Scanner s = new Scanner (System.in);
c. Storing the input to the variable name based on data type
For String: s.nextLine()
For int: s.nextInt()
For double: s.nextDouble()
The writeOutput() method will be used to display an output similar to the sample below.
You are purchasing 3 bag(s) at 1,745.5 each.
4. Inform your instructor once you are done.
Sample output:
IT1712
02 Laboratory Exercise 1 *Property of STI
Page 2 of 2
GRADING RUBRIC (100 points):
Criterion Description Max Points
Correctness The code produces the expected result. 40
Logic The code meets the specifications of the problem. 40
Efficiency The code is concise without sacrificing correctness and logic. 10
Syntax The code adheres to the rules of the programming language. 10


On this page of the site you can watch the video online Laboratory Exercise Classes and Methods Computer Programming 2 Answer with a duration of hours minute second in good quality, which was uploaded by the user Games with Brian 17 December 2022, share the link with friends and acquaintances, this video has already been watched 2,950 times on youtube and it was liked by 23 viewers. Enjoy your viewing!