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.
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
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.