Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1 In a class called H2P1.java, which you will submit to Canvas, write a program (within main) that asks the user to enter the

Problem 1 In a class called H2P1.java, which you will submit to Canvas, write a program (within main) that asks the user to enter the a, b, c values (separated by spaces and in this order) corresponding to the coefficients of a quadratic function in standard form: y = ax2 + bx + c. The program should then compute and output to the screen the x and y coordinates of the vertex of the parabola that represents the given quadratic function. Furthermore, if the vertex is also a zero or a y-intercept (or both) for the same function, then you should print an appropriate message to the user indicating these facts. Here is a sample run of this program: Enter the a, b, and c of your quadratic function (separated by spaces): 1 0 0 The vertex of the corresponding parabola is: (0, 0) This vertex is also the zero of your parabola. This vertex is also the y-intercept of your parabola. Hint: For a function f(x) = ax2 + bx + c, the vertex is at Note: Your code should not display a (-0), as there is not negative zero. You must remedy this issue. Problem 2 The We-Say-So Corporation needs a program to calculate how much to pay their hourly employees. US labor laws state that hourly employees should be paid time and a half for any hours over 40 that they work in a single week. So for example, if an employee works for 46 hours in a week, then they get 6 hours of overtime, at 1.5 times their base pay. The We-Say-So Corp. is based in a state where the minimum wage is 5.25 dollars per hour. It is company policy that employees should not work for more than 60 hours in a single week. In a class called H2P2.java, which you will submit to Canvas: a) Write a method called salaryTotal that takes two inputs: the base pay and hours worked in a week as parameters, and either returns the total pay, -1 if base pays is less than minimum wage, or -2 if number of hours worked is more than 60.

Page2 b) Also, write a main() method that asks the user (a manager, presumably) to input the full name, the base pay and the hours worked in a week for a particular employee using the keyboard (separated by commas and in this order). main should use salaryTotal to compute the total pay for that employee and then print one of the following messages to the screen: The total pay for is dollars. or The number of hours your entered does not comply with company policy. or The base salary you entered does not comply with state law.

In Java please

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

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

More Books

Students also viewed these Databases questions