You are writing a program to convert Ounces to Grams for 3 different measurements of Ounces.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Using jGRASP please write this code 

 

You are writing a program to convert Ounces to Grams for 3 different measurements of Ounces. 

 

Create a class called ConversionsOunces that contains the following:

  • a data member for an array to hold 3 different measurements in Ounces.
  • a constructor that accepts a parameter for an array that stores the 3 different measurements in Ounces
  • a method that calculates the total Ounces input for the 3 different measurements of Ounces
  • a method that calculates the total Grams by converting the total Ounces to total Grams. To convert Ounces to Grams, multiply total Ounces by a factor of 28.35 

Create a program called ConversionsOuncesDemo that references the ConversionsOunces class that contains the following:

  • an array to store the 3 different measurements in Ounces input by the user
  • a for loop that prompts the user to enter the Ounces to be converted so that the user can input 3 different measurements of Ounces
  • create an object that represents the Ounces stored within the array
  • for the object created, run the method that totals the Ounces for the 3 different measurements input and display the result
  • for the object created, run the method that totals the Grams by multiplying the total Ounces by a factor of 28.35 and display the result

Other reminders:

Use camelCase correctly

Indent correctly

Comment at the top of each program and within each program

Use the test data given for testing.

 

Here is how the program will run. Test data input is italicized and bolded.

 

Please enter the total ounces for item 1

1

Please enter the total ounces for item 2

2

Please enter the total ounces for item 3

3

The total ounces converted is       6.00.

The total grams converted is     170.10.

 

You are writing a program to convert Ounces to Grams for 3 different measurements of Ounces.
Create a class called ConversionsOunces that contains the following:
• a data member for an array to hold 3 different measurements in Ounces.
a constructor that accepts a parameter for an array that stores the 3 different measurements in Ounces
• a method that calculates the total Ounces input for the 3 different measurements of Ounces
• a method that calculates the total Grams by converting the total Ounces to total Grams. To convert Ounces to
Grams, multiply total Ounces by a factor of 28.35
Create a program called ConversionsOuncesDemo that references the ConversionsOunces class that contains the
following:
an array to store the 3 different measurements in Ounces input by the user
• a for loop that prompts the user to enter the Ounces to be converted so that the user can input 3 different
measurements of Ounces
• create an object that represents the Ounces stored within the array
• for the object created, run the method that totals the Ounces for the 3 different measurements input and
display the result
• for the object created, run the method that totals the Grams by multiplying the total Ounces by a factor of
28.35 and display the result
Other reminders:
Use camelCase correctly
Indent correctly
Comment at the top of each program and within each program
Use the test data given for testing.
Here is how the program will run. Test data input is italicized and bolded.
Please enter the total ounces for item 1
1
Please enter the total ounces
it
2
2
Please enter the total ounces for item 3
3
The total ounces converted is
6.00.
The total grams converted is
170.10.
Transcribed Image Text:You are writing a program to convert Ounces to Grams for 3 different measurements of Ounces. Create a class called ConversionsOunces that contains the following: • a data member for an array to hold 3 different measurements in Ounces. a constructor that accepts a parameter for an array that stores the 3 different measurements in Ounces • a method that calculates the total Ounces input for the 3 different measurements of Ounces • a method that calculates the total Grams by converting the total Ounces to total Grams. To convert Ounces to Grams, multiply total Ounces by a factor of 28.35 Create a program called ConversionsOuncesDemo that references the ConversionsOunces class that contains the following: an array to store the 3 different measurements in Ounces input by the user • a for loop that prompts the user to enter the Ounces to be converted so that the user can input 3 different measurements of Ounces • create an object that represents the Ounces stored within the array • for the object created, run the method that totals the Ounces for the 3 different measurements input and display the result • for the object created, run the method that totals the Grams by multiplying the total Ounces by a factor of 28.35 and display the result Other reminders: Use camelCase correctly Indent correctly Comment at the top of each program and within each program Use the test data given for testing. Here is how the program will run. Test data input is italicized and bolded. Please enter the total ounces for item 1 1 Please enter the total ounces it 2 2 Please enter the total ounces for item 3 3 The total ounces converted is 6.00. The total grams converted is 170.10.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY