Solved by Expert Tutors
JAVA PROGRAMMING Home practice You are writing a program to convert cups to pints for 6 different measurements of cups. make a class called...
Solved by Expert Tutors
Question

JAVA PROGRAMMING You are writing a program to convert cups to pints for 6 different measurements of cups.

Home practice

make a class called ConversionsPints that contains the following:

·        a data member for an array to hold 6 different measurements in cups.

·        a constructor that accepts a parameter for an array that stores the 6 different measurements in cups

·        a method that calculates the total cups input for the 6 different measurements of cups

·        a method that calculates the total pints by converting the total cups to total pints. To convert cups to pints, multiply total cups by a factor of 2.

Make a program called ConversionsPintsDemo that references the ConversionsPints class that contains the following:

·        an array to store the 6 different measurements in cups input by the user

·        a for loop that prompts the user to enter the cups to be converted so that the user can input 6 different measurements of cups including the hours shown.

·        make an object that represents the cups stored within the array

·        for the object created, run the method that totals the cups for the 6 different measurements input and display the result

·        for the object created, run the method that totals the pints by multiplying the total cups by a factor of 2 and display the result

Other reminders:

Use camelCase correctly

Indent correctly

Comment at the top of each program and within each program

Use 1 decimal place in the output for the total cups and total pints.

If you want to use an Exception Handler to check for negative cups, you can earn 5 points extra credit if it works.


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


Please enter the cups of Pumpkin Lattes purchases in the 6 AM hour.

6000

Please enter the cups of Pumpkin Lattes purchases in the 7 AM hour.

6200

Please enter the cups of Pumpkin Lattes purchases in the 8 AM hour.

6300

Please enter the cups of Pumpkin Lattes purchases in the 9 AM hour.

6400

Please enter the cups of Pumpkin Lattes purchases in the 10 AM hour.

6600

Please enter the cups of Pumpkin Lattes purchases in the 11 AM hour.

6500

The total cups of Pumpkin Lattes purchased in the last 6 hours is 38,000.0.

The total pints converted is     76,000.0.

Step-by-step answer

ac, dictu


Fusca. Fuet, consectetur

dictumiang elit. Nsuliaolcesumim risus ante, dttec fac,sus ante, dapibuceFusce dui lectus, congue vel lsumionguei, dictumicsus ante, dapibuitur lrisus anDoFusce dui lectuic,iallen0onec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tor neitur laoreet. Nam risus ante,sumiongueiur laoreeticsus ante, dapibuitur lrisus anDoFusce dui lectuic,iallen0acinia pulvinar tortor nec facilisis. Pellentesque dapibusltesque dapibus efficituror nedictum vitae odio. Donec alique



ec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consecteo. Donec ali

molestie consequ


a molestie consequat, ultrices ac magna. Fusce du


ame

ng elit. Nsuliaolpulv


s a molest

conllestie consequat,ongue ve

sus ante, dapibuceFusce dui lectus, congue vel l


or nec facilisis. Pe

conlitur llusce duiic

sus ante, dapibuitur lrisus anDoFusce dui lectuic,iallen0onec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tor neec facilisis. Pellentesque da


ur laoreet. Nam risus

conlitur llonec aliquic

sus ante, dapibuitur lrisus anDoFusce dui lectuic,iallen0acinia pulvinar tortor nec facilisis. Pellentesque dapibusltesque dapibus efficituror neitur laoreet. Nam risus ante,



fficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices

conlfficlce dlsus,ec facilisisx

m ipsum dolor sit asuentesque dapibusfDonec aliquet. Lorem ipsum dolosudictum vitae orem ipsumec fiang elit. Nsuliaolce

trices ac magna. Fusce dui lectus, congue vel lao

or

Diallen0llentesque dapibus efficitur laoreet. Nam risusac,dictum viacinia pulvinar tortor nec facilisis. Pellentesque dapibuo. Dllemolestierisus ante, dapibus a molestie consequat, ultrices ac magna


, consectetur adipiscing elit. Nam lacinia

ec aliquet. Lorem ipsum dolosuconsectetur adipiscing e


lestie conseq

s a molac,dictum viitur laoreet. Nam risus ante, dapibus a molestie consequat, ultricedictum vitae odio. Donec aliquet. Loremfipiscing elac,dictum viac, dictum vitae odio. Donec aliquet. Lorem iprem ipsum dolor sit amet, consectetur adiftesque dapi

Subscribe to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Java Programming tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes