
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question

Transcribed Image Text: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
+ setltemName(String newltemName): void
+ setTotalCost (int quantity, double price): void
getltemName(): 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:
For int:
For double:
s.nextLine()
s.nextint()
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:
Enter the name of the item you are purchasing.
bag
Enter the quantity and price separated by a space.
3 1475.50
You are purchasing 3 bag (s) at 1475.5 each.
Amount due is 4426.50
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Similar questions
- // main module Module main() // Local variables Declare Real weight, shipping // Get package weight Call getWeight(weight) // Calculate the shipping charge Call setShipping(weight, shipping) // Display shipping charge Call showShipping(shipping) End Module // The getWeight module gets package weight and stores it // in the inputWeight reference variable. Module getWeight(Real Ref inputWeight) Display “Enter package weight: ” Input inputWeight End Module // The setShipping module sets the shipping charge and stores it // in the calcShipping reference variable. Module setShipping(Real weight, Ref calcShipping) If weight > 10 Then Set calcShipping = 3.80 Else If weight > 6 Then Set calcShipping = 3.70 Else If weight > 2 Then Set calcShipping = 2.20 Else Set calcShipping = 1.10 End If End Module // The showShipping module accepts shipping as argument // and displays the amount Module…arrow_forward1.Problem Description Student information management system is used to input, display student information records. The GUI interface for inputing ia designed as follows : The top part are the student imformation used to input student information,and the bottom part are four buttonns, each button meaning : (2) Total : add java score and C++ score ,and display the result; (3) Save: save student record into file named student.dat; (4) Clear : set all fields on GUI to empty string; (5) Close : close the window of GUIarrow_forwardVisual Studio views may be reshaped in many ways, but which is the fastest?arrow_forward
- What is the purpose of the sandbox model?arrow_forwardConsider the following recurrence relation: T(0) = 2, T(1) = 5, T(n) = 27(n – 1) – T(n – 2) for n>1 Write out the first few values T(0), T(1), T(2),...,. Make a guess about the closed form of T(n) and then prove that it is a closed form for T(n) using induction.arrow_forwardlanguage is C++ Use Lastname First name, JonnyEnglish Instructions 1. Using Visual Studio, or Xcode, create a new empty project in your working drive. Name the Project: 05LastFirst (NOTE: where LastFirst is your actual Lastname and Firstname. For Example, if your name is Mary Smith then your empty project folder will be named 02SmithMary) 2. You will be updating your 05CH3 program. You will develop an Algorithm and then update your C++ Program for the problem described below: Have the user input test grades UNTIL user enters a negative number. The program will: list the number of grades entered, list the number of passing grades (>= 60) total all the grades, and then display the average of the grades. For example: Enter score 1: 88.8 Enter score 2: 50 Enter score 3: 100 Enter score 4: 100 Enter score 5: -1 Total number of grades: 4 Total number of passing grades: 3 Total: 338.8 Average: 84.7 (NOTE: Follow the steps below in creating your Algorithm and C++ Program.…arrow_forward
- In the same way that attributes dictate whether or not a control is shown on the form at runtime, attributes also determine whether or not a control is displayed on the form at design time.arrow_forwardIn the same way that attributes dictate whether or not a control is shown on the form at runtime, attributes also determine whether or not a control is displayed on the form at design time.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY