IMPORTANT: This is an individual assignment. Pair programming does NOT begin until PSA 2. You must do this assignment on your own, and turn in your own.
Note: There is NO interview process required for this PSA. (All PSAs after this one will have a required interview.)
This work should be done in it's own directory. (see Details section below)
This homework requires skills from Chapter 1 and Chapter 2.
You have been hired to work at the Krusty Krab restaurant. Your boss, Eugene Krabs, wants you to write a program to run calculations to help with planning ingredients and prices for the restaurant. Write this program in a file called KrustyKrab.java. Your program should do the following things (in order):
Prompt the user to input (type on the keyboard) the number of ounces of Seahorse meat they have, as a whole number. Save this into an integer variable called ozSeahorseMeat. See pg. 81 of the book for an example of good style for the message you give the user telling them what to do.
Output the number of Krabby Patties that can be made using the Seahorse meat the restaurant currently has. It takes 4 oz of Seahorse meat to make one Krabby Pattie (just for fun: see the Krabby Pattie Secret Recipe here). Remember: nobody wants a partial Krabby Pattie, so the number you output should be an integer representing only the number of complete Krabby Patties that can be made.
Prompt the user to input two whole numbers separated by space(s): the number of dollars spent on potatoes for Krabby Fries this month, and the number of servings of Krabby Fries that can be made from those potatoes (again, see pg. 81 of the book). Save these into integer variables called friesExpense and friesServings.
Output the price that the restaurant should charge per serving of Krabby Fries to “break even” (no profit, but not lose money either). This should be a floating point value, because Mr. Krabs wants to know as close as possible to the exact amount (it is ok that more than 2 decimal places are printed out--in other words don't worry that the answer may include fractions of a penny).
After you get the program to compile with no errors, you should test it with many different values. Trade test cases with others on the WebBoard!
mkdir psa1 < enter >
Go into that directory (like double clicking to open a folder) with the command:
cd psa1 < enter >
You MUST name your directories (folders) and files as indicated in the problem descriptions. Otherwise, the turnin program may not work.
The blue stuff is what the user types in. The "-bash-2.05b$" thing you should recognize as the thing that always comes before your cursor when you are in UNIX on ieng6 (it is called a "prompt" because it is sort of prompting you to type a command). NOTE: Your wording does not need to be exactly the same. Just as long as you tell the user what to type, and what the answers are, in a reasonable way, that's fine if you don't use the exact same wording and format that I did.-bash-2.05b$ java KrustyKrab Welcome to KrustyKrab-O-Matic. Please enter number of ounces of Seahorse meat on hand: 5 Krabby Patties use 4oz. of Seahorse meat each, so you can make 1 Krabby Patties. Please enter dollars spent on potatoes this month, and servings of Krusty Fries they can make (separated by one or more spaces): 4 3 To break even, charge $1.3333334 per serving of Krusty Fries. -bash-2.05b$
When you are ready to turn in your homework, run bundle-psa1
from your psa1 directory. The session should look like
this:
-bash-2.05b$ cd ~/psa1
-bash-2.05b$ bundle-psa1
Good; all required files are present:
KrustyKrab.java
Do you want to go ahead and turnin these files? [y/n]y
OK. Proceeding.
Performing turnin of approx. XXXX bytes
Copying to /home/linux/ieng6/cs8f/turnin.dest/cs8fzz.psa1
.
Done.
Total bytes written: XXXX
Please check to be sure that's reasonable.
Turnin successful.
If you want to make changes after you've turned
in your homework, make the changes and run bundle-psa1
again. The program will warn you that a "previously turned-in
file exists" and ask if "you wish to over-write this
existing file" (delete the old version and replace it with this
new one). Respond in the affirmative by typing y and
pressing the Enter key.
vimtutor, a separate program that will teach you to
use Vim.
emacs and, within
the editor, typing CTRL-h t.
Which editor should I use?
For most of us, the choice of a text editor is a matter of preference (or, more likely, familiarity). It happens that Beth Simon and Cynthia Lee use Vim, but many other computer scientists use Emacs. Both may seem hard at first, and both will become second nature with practice. So, in that sense, it doesn't matter which one you choose.