Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program is in java and it should in simple language as soon as it is the second chapter. Chapter 2 Assignment (Converting Ounces) -

This program is in java and it should in simple language as soon as it is the second chapter. image text in transcribed
Chapter 2 Assignment (Converting Ounces) - 15 points Your goal is to ask the user for a total number of ounces and convert this to cups, pints, quarts, and gallons Your program should have the following: Make the name of the project OuncesConversion Have a dialog box appear on screen that requests the user to type in the total number of ounces. For this example, I used 92, but you could use any number that you choose. 2 points) OK Cancel Place the response that a user types in into a String variable. Then convert that string using the parseDouble method in Double class and place this double into a variable (make sure that you follow the Java variable naming rules). (2 points) Have the computer convert the number of ounces entered by the user into cups, pints, quarts, and gallons. You will need to create a variable for each of the conversions. Make sure that you calculations are using the variable that you created for ounces. (5 points) 1 cup 8 oz 1 pint - 16 oz I quart=32 oz 1 gallon - 128 oz Have the computer display the number of ounces entered by the user and the converted number of cups, pints, quarts, and gallons. Make sure that you are using variables for your output and not typing the answers into this box. (4 points) Format the variables to have 2 decimals places, but only if there is a number to display (Hint: use the "#" for your formatting pattern instead of "0"). (2 points) Message Ounces: 92 Cups: 11.5 Pints: 5.75 Quarts: 2.88 Gallon: 0.72 [OK]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications Dasfaa 2023 International Workshops Bdms 2023 Bdqm 2023 Gdma 2023 Bundlers 2023 Tianjin China April 17 20 2023 Proceedings Lncs 13922

Authors: Amr El Abbadi ,Gillian Dobbie ,Zhiyong Feng ,Lu Chen ,Xiaohui Tao ,Yingxia Shao ,Hongzhi Yin

1st Edition

3031354141, 978-3031354144

More Books

Students also viewed these Databases questions

Question

Name two volatile attributes

Answered: 1 week ago

Question

2. Develop a persuasive topic and thesis

Answered: 1 week ago

Question

1. Define the goals of persuasive speaking

Answered: 1 week ago