Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Can you please help me on all of question 2? m oy workerl = new Employee (JohnSmith, 50000); 17 John Smith has salary - $50,000.

Can you please help me on all of question 2? image text in transcribed
image text in transcribed
m oy workerl = new Employee ("John""Smith", 50000); 17 John Smith has salary - $50,000. workeri.raiseSalary(20); // John Smith now has salary - $60,000. Use the method header below to write raiseSalary. public void raiseSalary (double by Percent) c. Write a method calculateBonusAmount for the Employee class. The method calculateBonusAmount will calculate and return the amount of money to be given to an employee as a holiday bonus. This amount is based on the salary of the employee and the given percent passed as a parameter to the method. For example: Employee workeri - new Employee ("John", "Smith", 50000); // John Smith has salary = $50,000. System.out.println (workeri.calculateBonusAmount (3)); // 1500.0 will be printed Use the method header below to write calculateBonusAmount. public double calculateBonusAmount (double by Percent) 2. A Book class is to be implemented with the following properties. A Book object has a title (a String), an author (a String), and a price (a double). An incomplete definition for the Book class is shown below. public class Book 46 Java Concepts Advanced Placement CS Study Guide // Constructor goes here Returns price of book. Greturn price of book public double getPrice () return price; Decreases book price. param by Percent the percent the price is decreased public void giveDiscount (double by Percent) // Code goes here private String title: private String author private double price, Write a constructor for the Book class that has three parameters: a title (a String), an author (a String), and a price (a double). b. Write the method giveDiscount that modifies the price of the book by decreasing the price of the book by a given percentage. For example: Book myFavoriteBook - new Book ("The Cat in the Hat Comes Back", Dr. Seuss", 10.00); my FavoriteBook.giveDiscount (15); // price - 8.5 System.out.println("The new price of the book is - + my favoriteBook.getPrice()); // Output would be the new price of the book is 8.5 Use the method header below to write giveDiscount. public void giveDiscount (double by Percent)

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_2

Step: 3

blur-text-image_3

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

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students explore these related Databases questions