question archive (a) Write an if statement that increases pay by 3% if score is greater than 90
Subject:Computer SciencePrice:2.89 Bought3
(a) Write an if statement that increases pay by 3% if score is greater than 90.
(b) Write an if statement that increases pay by 3% if score is greater than 90, otherwise increases pay by 1%.
a)
import java.util.Scanner;
public class PayIncrease {
public static void main(String args[])
{
int pay = 1000;
Scanner input = new Scanner(System.in);
int score;
System.out.println("Enter Score: ");
score = input.nextInt();
if(score > 90)
{
pay = (pay/100)*3 + pay;
System.out.println("3% increased pay is: " + pay);
}
}
}
b)
import java.util.Scanner;
public class PayIncrease {
public static void main(String args[])
{
int pay = 1000;
Scanner input = new Scanner(System.in);
int score;
System.out.println("Enter Score: ");
score = input.nextInt();
if(score > 90)
{
pay = (pay/100)*3 + pay;
System.out.println("3% increased pay is: " + pay);
}
else
{
pay = (pay/100)*1 + pay;
System.out.println("1% increased pay is: " + pay);
}
}
}