Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task # 1 Algorithm 1 . Write a program which includes identifier declarations and a statement that is needed to enable Java to read from

Task #1 Algorithm
1. Write a program which includes identifier declarations and a statement that is needed to enable
Java to read from the keyboard. These are not part of actually completing the task of calculating
pay, so they are not included in the pseudocode. The only important difference between the
example pseudocode and the Java code is in the calculation.
2. The main objective of the program is to calculate the users gross pay. It calculates the gross pay
by multiplying the number of hours worked by hourly pay rate. However, it is not always
calculated this way. What if you work 45 hours in a week? The hours that you worked over 40
hours are considered overtime. You will need to be paid time and a half for the overtime hours
you worked. Below is the detailed pseudocode for your Task#1 but without the calculation part.
You need to fill in lines that tell in English what the calculation part of Task#1 is doing.
Display How many hours did you work?.
Input hours.
Display How much are you paid per hour?.
Input rate.
If hours are 40 or less, then store the value of hours times rate in the pay variable
Else store the value of 40 times rate (regular pay) added together with 1.5 times rate times the
difference of hours and 40(overtime pay) in the pay variable.
Display the value in the pay variable.
Task #2 Compile and Execute a Program
1. Compile your program using the JDK or a Java IDE as directed by your instructor.
2. You should not receive any error messages.
3. When this program is executed, it will ask the user for input. You should calculate several
different cases by hand. Since there is a critical point at which the calculation changes, you
should test three different cases: the critical point, a number above the critical point, and a
number below the critical point. You want to calculate by hand so that you can check the logic of
the program. Fill in the chart below with your test cases and the result you get when calculating
by hand.
4. Execute the program using your first set of data. Record your result. You will need to execute the
program three times to test all your data. Note: you do not need to compile again. Once the
program compiles correctly, it can be executed many times. You only need to compile again if
you make changes to the code.
Hours Rate Pay (hand
calculated)
Pay (program
result)
4010400400.0
3010300300.0
4510475475.0
Second: Write a program for the following problem:
One interesting application of computers is to display graphs and bar charts. Write an application
that reads five numbers between 1 and 30. For each number thats read, your program should
display the same number of adjacent asterisks. For example, if your program reads the number 7,
it should display *******. Display the bars of asterisks after you read all five numbers.

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

Students also viewed these Databases questions

Question

i need the record could you help me please

Answered: 1 week ago