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

1. Write a Java program that will read 10 double sale values and store them in a

ID: 3543588 • Letter: 1

Question

1. Write a Java program that will read 10 double sale values and store them in array.Name is: sales. Find the subtotal of the sales, tax them 8.25% (use this as constant) and calculate the total by adding the tax due. Print all your results.

2. Write a  java program that will read 10 integers values into an array. Name the array: listOfInts. Add and count only these values that are >= 100 and <= 500. Print the sum of these values that meet the condition and how many of them. If the number of these values is >= 5, state "Good work," otherwise, print "Need reevaluation."

Explanation / Answer

(1)


import java.util.Scanner;


class Q1

{

public static void main(String[] args)

{

Scanner scan = new Scanner(System.in);

int i = 0; Double sales[] = new Double[10];

Double subtotal = 0.0;

for(i=0;i<10;i++)

{

sales[i] = scan.nextDouble();

subtotal += sales[i];

}


Double tax = (8.25*subtotal)/100;

Double total = subtotal+tax;

System.out.println("SubTotal is : "+subtotal+" "+"Tax is : "+tax+" "+"Total is : "+total);

}

}