Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following output, and main function. Write the functions that are used by main mport java.util.Scanner blic class Main Type -1 for cups to

image text in transcribed
image text in transcribed
image text in transcribed
Given the following output, and main function. Write the functions that are used by main mport java.util.Scanner blic class Main Type -1 for cups to exit Eneer nunber of cups: 5 private static Scanner keyboard - new Scanner (System. in): id quis ences public static void main (String ( args) 57 cups is equal to: 3.56 gallens Enter nunber of cops: 3 Liquid Equivalences int cups: double ouncesi double quartsi double gallons upsal toi 24.00 ounces 0.19 gailons System.out.println("Type-1 for cups to exit") cups getValidCups while (cups-1) Enter nunter of cups. nvalid -try againt Enter nunber of cps:-9 Invalid try again:t Enter nunber of cups:-74 tnvalid try againtt Enter nunber of cups: 10 Liquid Equivalences 10 cups is oqual to: ouncescomputeounces (cups) gallons computeGallons (cups) print (ounces, cups, gallons): cups-getValidCups ): 00.00 ounces 0.63 gallons Enter unber of cupa:1 The Write the function definition for print used by the main function above. function should print the Liquid Equivalences section as shown on the output given. (Notice the decimal points) pts] 17. [5 pts) Write the function definition for computeGallons used by the main function. This function computes the number of ounces, the number of quarts, and the number of gallons in the number of cups that were entered B ounces I cup cups 1 quart 4 quarts- I gallon Write the function definition for computeOunces used by the main function. This function computes the number of ounces, the number of quarts, and the number of gallons in the number of cups that were entered 18. [5 pts] 8 ounces 1 cup 4 cups 1 quart 4 quarts 1 gallon 7/9 19. [15 pts] Write the function definition for getValidCups used by the main function. Notice that the cups cannot be negative-see output)

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

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions