Laboratory Exercise Classes and Methods Computer Programming 2 Answer
Answer for this laboratory exercise
https://elms.sti.edu/files/3056044/02_Laboratory_Exercise_1(14).pdf?lmsauth=9d0d51e046fe8adea826d58a26379006a823d19f
You can see the answer code here: https://github.com/Brian-Serrano?tab=repositories
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
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Laboratory Exercise Classes and Methods Computer Programming 2 Answer», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.