Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

present percent. 2. Write a program that asks the user to enter three test score

ID: 3727822 • Letter: P

Question

present percent. 2. Write a program that asks the user to enter three test scores. The program should display each test score, as well as the average o f the scores. 3. An electronics company sells circuit boards at a 40 percent profit. If you know the retail price of a circuit board, you can calculate its profit with the following formula: Profit-Retail price x 0.4 Write a program that asks the user for the retail price o fa circuit board, calculates the amount of profit earned for that product, and displays the results on the screen. 4. Write a program that computes the tax and tip on a restaurant bill. The program should ask the user to enter the charge for the meal. The tax should be 6.75 percent of the meal charge. The tip should be 15 percent of the total after adding the tax. Display the meal charge, tax amount, tip amount, and total bill on the screen. 5. A soft drink company recently surveyed 12,467 of its customers and found that approximately 14 percent of those surveyed purchase one or more energy drinks per week. Of those customers who purchase energy drinks, approximately 64 percent of them prefer citrus flavored energy drinks. Write a program that displays the following . The approximate number of customers in the survey who purchase one or more energy drinks per week. . The approximate number o f customers in the survey who prefer citrus-flavored energy drinks.

Explanation / Answer

//answer for ques no:2

import java.util.*;
public class avg_score {
public static void main(String args[])
{ Scanner sc=new Scanner(System.in);
float marks[]=new float[3];
float sum=0;
for(int i=0;i<3;i++)
{
System.out.println("enter score "+(i+1)+":");
marks[i]=sc.nextFloat();
sum+=marks[i];
}
for(int i=0;i<3;i++)
{
System.out.println("score "+(i+1)+" is:"+marks[i]);
}
System.out.println("average score is:"+(sum/3));//calculate average
  
  
  
}
  
}

//answer for ques no:3

import java.util.Scanner;


public class profit {
public static void main(String args[])
{ Scanner sc=new Scanner(System.in);
double price=0;
System.out.println("enter price of product:");
price=sc.nextFloat();
double profit=(price*0.4);
System.out.println("profit is:"+profit);
  
  
  
}
  
}

//answer for ques no:4

import java.util.Scanner;


public class bill {
public static void main(String args[])
{ Scanner sc=new Scanner(System.in);
double price=0;
System.out.println("enter price of the meal:");
price=sc.nextFloat();
double tax=(price*6.75/100);//calc tax
double tip=((price+tax)*15/100);//calc tip
  
double bill=price+tax+tip;
System.out.println("meal charge:"+price);
System.out.println("tax amount:"+tax);
System.out.println("tip amount:"+tip);
System.out.println("total bill:"+bill);
  
}
}

//answer for ques no:5

import java.util.Scanner;

public class survey {
public static void main(String args[])
{
int customers=12467;
System.out.println("no of customers="+customers);
System.out.print("Approx. no of people who purchased one or more energy dinks per week=");
System.out.println((int)(customers*(0.14)));//14% customers
System.out.print("Approx. no of people who prefer citrus flavoured energy drinks=");
System.out.println((int)(customers*(0.14)*(0.64)));//in 14% the 64% prefers citrus drink
}
  
}