Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(4 pts) Problem 3 Suppose you're throwing a wild party for yourself and 9 of your closest friends. Since this party is wild. you expect

image text in transcribed
(4 pts) Problem 3 Suppose you're throwing a wild party for yourself and 9 of your closest friends. Since this party is wild. you expect each person (including yourself) to drink 14 cans of uh... strawberry juice. You don't want to disappoint any of your friends (or yourself), so you need to make sure there's enough strawberry juice available: 10 people 14 cans/person-140 cans. But you can't just buy strawberry juice in individual cans - it's sold only in 6-packs. Thus, you need to buy at least 24 of those 6-packs (giving you a total of 144 cans) to satisfy everyone. The extra 4 cans can be saved for next time, or perhaps used as an incentive to encourage your guests to help you clean up afterward. After throwing several of these parties, you're getting tired of doing the math yourself every time. Let's do the computer scientist thing and generalize the problem so we can write a program to solve it. You want to throw a party for f friends, each of whom will drink c cans of a wholesoue, healthy beverage which is sold only in p-packs. (As before, ussume that you'll partake in the drinking yourself too.) Within your Lab2HW folder, write a program and p. The program should then report the minimum number of p-packs that need to be bought, along with the number of extra cans (if any) that you'll have. The program should also allow you to enter the name of the drink (as a string) and include that name in its results. named PartyPlanner.java that reads user iuput for f, c

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

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

Students also viewed these Databases questions