Due: 2024-09-16 23:59:00EDT
In this assignment you will be working with variables, and reading in user data.
Note, in the examples,
*
indicates user input.
Write a program called Groceries.java
that computes the cost of groceries per week. Each person buys a different amount of groceries per week. You will ask a user to input
The program will then print out how much thaat person spends on groceries each week.
$ javac Groceries.java
$ java Groceries
How many times do you go to the grocery store each week? *2*
How much do you spend on each trip? *50.25*
This week you spent $100.50 on groceries.
Requirements:
- Print out two decimal points
Write a program, Timer.java
that computes the time when the user will finish all of their tasks. The program should ask the user for the following information:
Here is an example
$ javac Tasks.java
$ java Tasks
Enter the current hour: *23*
Enter the number of tasks: *1*
Enter the number of hours a task takes: *5*
You will finish at 4:00 o'clock.
$ javac Tasks.java
$ java Tasks
Enter the current hour: *9*
Enter the number of tasks: *3*
Enter the number of hours a task takes: *2*
You will finish at 15:00 o'clock.
You can assume that all times are integers that represent the time on a 24-hr “military” clock. For example, 7 PM is 19:00, or 19, in this representation.
Requirements:
- Dont worry about minutes or seconds, just hours. Use the
%
operator
Write a program, called Taylor.java
, which will ask a prompt the user for the following information:
and then prints out the following song:
$ javac Taylor.java
$ java Taylor
Please input a noun: *problem*
Please input a drink: *gatorade*
Please input an verb: *look*
Please input a noun: *moon*
Please input a noun: *sun*
Please input an adjective: *tiring*
Please input a gerund: *cheering*
It's me, hi, I'm the problem, it's me
At gatorade time, everybody agrees
I'll look directly at the moon but never in the sun
It must be tiring always cheering for the anti-hero
In a text file called README.txt
answer the following questions:
Dont forget: make sure to fill in the header in all of your java files.
Submit the following files to the assignment called HW01
on Gradescope:
Taylor.java
Timer.java
Groceries.java
README.txt
Make sure to name these files exactly what we specify here. Otherwise, our autograders might not work and we might have to take points off.