No. 3 • Write an application that calculates and displays the weekly salary for an employee. The main() method prompts the user for an hourly pay rate, regular hours, and overtime hours. Create a separate method to calculate overtime pay, which is regular hours times the pay rate plus overtime hours times 1.5 times the pay rate; return the result to the main() method to be displayed. Save the program as Salary.java.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter7: Using Methods
Section: Chapter Questions
Problem 3E
icon
Related questions
Question
No. 3
• Write an application that calculates and displays
the weekly salary for an employee. The main()
method prompts the user for an hourly pay rate,
regular hours, and overtime hours.
Create a separate method to calculate overtime
pay, which is regular hours times the pay rate plus
overtime hours times 1.5 times the pay rate; return
the result to the main() method to be displayed.
Save the program as Salary.java.
Transcribed Image Text:No. 3 • Write an application that calculates and displays the weekly salary for an employee. The main() method prompts the user for an hourly pay rate, regular hours, and overtime hours. Create a separate method to calculate overtime pay, which is regular hours times the pay rate plus overtime hours times 1.5 times the pay rate; return the result to the main() method to be displayed. Save the program as Salary.java.
No. 4
a) Create a class named Student. A Student has fields
for an ID number, number of credit hours earned, and
number of points earned. (For example, for every 1
unit a student earns 5 points). Include methods to
assign values to all fields. A Student also has a field
for grade point average. Include a method to compute
the grade point average field by dividing points by
credit hours earned.
Write methods to display the values in each Student
field. Save this class as Student.java.
b) Write
instantiates a Student object from the class you
created and assign values to its fields. Compute
the Student grade point average, and then display
a
class
named
ShowStudent
that
all the values associated with the Student. Save
the application as ShowStudent.java.
c) Create a constructor for the Student class you
created. The constructor should initialize each
Student's ID number to 9999, his or her points
earned to 15, and credit hours to 3 (resulting in a
grade point average of 3.0). Write a program that
demonstrates that the constructor works by
instantiating an object and displaying the initial
values.
Save
the
application
as
ShowStudent2.java.
Transcribed Image Text:No. 4 a) Create a class named Student. A Student has fields for an ID number, number of credit hours earned, and number of points earned. (For example, for every 1 unit a student earns 5 points). Include methods to assign values to all fields. A Student also has a field for grade point average. Include a method to compute the grade point average field by dividing points by credit hours earned. Write methods to display the values in each Student field. Save this class as Student.java. b) Write instantiates a Student object from the class you created and assign values to its fields. Compute the Student grade point average, and then display a class named ShowStudent that all the values associated with the Student. Save the application as ShowStudent.java. c) Create a constructor for the Student class you created. The constructor should initialize each Student's ID number to 9999, his or her points earned to 15, and credit hours to 3 (resulting in a grade point average of 3.0). Write a program that demonstrates that the constructor works by instantiating an object and displaying the initial values. Save the application as ShowStudent2.java.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT