1. Write a program that asks the user to enter five test scores. the program sho
ID: 3544852 • Letter: 1
Question
1. Write a program that asks the user to enter five test scores. the program should display a letter grade for each score and average test score. design the following functions in the program:
*calcAverage-this function should accept five test scores as arguments and return the average of the scores.
*determineGrade-this function should accept a test score as an argument and return a letter grade for the score based on the following grading scale:
Score-90-100=A, 80-89=B,70-79=C, 60-69=D, BELOW 60=F
JAVA PLEASE
2. The distance a vehicle travels can be calculated as follows
Distance = speed * time
Write a method named distance that accepts a vehicle speed and time as arguments and returns the distance the vehicle has traveled.
JAVA PLEASE
Explanation / Answer
import java.util.*;
public class DISTANCE
{
public static double distance(double speed,double time)
{
return speed*time;
}
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
double speed;
double time;
System.out.println("Enter Speed of Vehicle: ");
speed = in.nextDouble();
System.out.println("Enter time taken by Vehicle: ");
time = in.nextDouble();
System.out.println("Distance Travelled by Vehicle is " + distance(speed,time));
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.