Discover a wealth of knowledge at Westonci.ca, where experts provide answers to your most pressing questions. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform.

A jewelry store distributes bonuses after the holiday rush. The table shows the bonuses based on full weeks worked during the season and the number of positive online customer reviews.
Positive Review Received Full Weeks Worked 0 1 2 3 4 or More 0 5.00 9.00 16.00 22.00 30.00 1 10.00 12.00 18.00 24.00 36.00 2 20.00 25.00 32.00 42.00 53.00 3 32.00 38.00 45.00 55.00 68.00 4 46.00 54.00 65.00 77.00 90.00 5 60.00 72.00 84.00 96.00 120.00 6 or more 85.00 100.00 120.00 140.00 175.00
Write: A program that allows the managers to continuously enter values for the two bonusdetermining factors (full weeks worked, and total positive reviews received) and displays the appropriate bonus formatted in US dollars.


Sagot :

Answer:

In Java

import java.util.Scanner;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int weeks, reviews;

 double bonus=0;

 System.out.print("Weeks: ");  weeks = input.nextInt();  System.out.print("Positive Reviews: ");  reviews = input.nextInt();

 while(weeks != 99 || reviews != 99){

     if(weeks == 0){

      if(reviews == 0)  {bonus = 5.00;}

      else if(reviews == 1)  {bonus = 9.00;}

      else if(reviews == 2)  {bonus = 16.00;}

      else if(reviews == 3)  {bonus = 22.00;}

      else if (reviews >=4){bonus = 30.00;}

     }

     else if(weeks == 1){

      if(reviews == 0)  {bonus = 10.00;}

      else if(reviews == 1)  {bonus = 12.00;}

      else if(reviews == 2)  {bonus = 18.00;}

      else if(reviews == 3)  {bonus = 24.00;}

      else if (reviews >=4){bonus = 36.00;}

     }

     else if(weeks == 2){

      if(reviews == 0)  {bonus = 20.00;}

      else if(reviews == 1)  {bonus = 25.00;}

      else if(reviews == 2)  {bonus = 32.00;}

      else if(reviews == 3)  {bonus = 42.00;}

      else if (reviews >=4){bonus = 53.00;}

     }

     else if(weeks == 3){

      if(reviews == 0)  {bonus = 32.00;}

      else if(reviews == 1)  {bonus = 38.00;}

      else if(reviews == 2)  {bonus = 45.00;}

      else if(reviews == 3)  {bonus = 55.00;}

      else if (reviews >=4){bonus = 68.00;}

     }

     else if(weeks == 4){

      if(reviews == 0)  {bonus = 46.00;}

      else if(reviews == 1)  {bonus = 54.00;}

      else if(reviews == 2)  {bonus = 65.00;}

      else if(reviews == 3)  {bonus = 77.00;}

      else if (reviews >=4){bonus = 90.00;}

     }

     else if(weeks == 5){

      if(reviews == 0)  {bonus = 60.00;}

      else if(reviews == 1)  {bonus = 72.00;}

      else if(reviews == 2)  {bonus = 84.00;}

      else if(reviews == 3)  {bonus = 96.00;}

      else if (reviews >=4){bonus = 120.00;}

     }

     else if(weeks >= 6){

      if(reviews == 0)  {bonus = 85.00;}

      else if(reviews == 1)  {bonus = 100.00;}

      else if(reviews == 2)  {bonus = 120.00;}

      else if(reviews == 3)  {bonus = 140.00;}

      else if (reviews >=4){bonus = 175.00;}

     }

     System.out.println("Bonus : $"+bonus);      System.out.print("Weeks: ");  weeks = input.nextInt();      System.out.print("Positive Reviews: ");  reviews = input.nextInt();

 }

}

}

Explanation:

See attachment 1 for complete question

See attachment 2 for explanation where I used comments to explain difficult lines

View image MrRoyal
View image MrRoyal
Thank you for your visit. We are dedicated to helping you find the information you need, whenever you need it. We hope this was helpful. Please come back whenever you need more information or answers to your queries. Westonci.ca is your trusted source for answers. Visit us again to find more information on diverse topics.