using building java program 4th edition. Chapter 1-4. if/else statement to write
ID: 3595151 • Letter: U
Question
using building java program 4th edition. Chapter 1-4. if/else statement to write following program
Following is the list of the tasks that needs to be done. For each task you are to create a method with the proper list of the parameters and proper return value. A method to output the description of the program A method that asks the user to enter the scores for the SAT subjects and then passing the info to the method that calculates the overall SAT score. A method to calculate the overall SAT score and return the value A method to ask the user to enter the ACT scores and pass it to method to calculate the overall ACT score A method to calculate the overall score for ACT and returning the result A method that gets the info needed regarding the gpa, calculates the weighted gpa using the given formula and returning the result 1. 2. 3. 4. 5. 6. 7. 8. A method that outputs the result regarding the two applicant. What are the parameters? A method that puts everything together. Calling all the other methods to generate the output. Problem: This assignment will give you practice with interactive programs, ifelse statements and methods that return values. Your program will prompt the user for information about two applicants and compute an overall score for each applicant. This is a simplified version of a program that might be used for admissions purposes.Explanation / Answer
import java.util.Scanner;
class Test // i'm assuming the class name as Test
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
double resultSat = 0.0d;
double resultAct = 0.0d;
System.out.print("How meny member details you want to calculate ?");
int count= sc.nextInt();
System.out.print("Do yo hsvr 1) SAT score or 2) ACT score ?");
int result=sc.nextInt();
if(result == 1){
System.out.print("SAT math?");
int satMath= sc.nextInt();
System.out.print("SAT critical Reading?");
int satCriticalReading= sc.nextInt();
System.out.print("SAT writing?");
int satWriting= sc.nextInt();
double satScore = this.calculateSatScore(satMath,satCriticalReading,satWriting);
System.out.print("exam Score = "+satScore);
System.out.print("overall GPA ?");
double satOverallGpa= sc.nextDouble();
System.out.print("max GPA ?");
double satMaxGpa= sc.nextDouble();
System.out.print("Transcript multiplier?");
double satTraScrMul= sc.nextDouble();
System.out.print("GPA score?");
double gpa = this.calculateGpa(satOverallGpa,satMaxGpa,satTraScrMul);
double resultSat = this.getResult(satScore,gpa)
System.out.print("First applicant over all score = "+resultSat);
}else{
System.out.print("Act English?");
int actEng= sc.nextInt();
System.out.print("Act math?");
int actMath= sc.nextInt();
System.out.print("Act Reading?");
int actReading= sc.nextInt();
System.out.print("Act Science?");
int actScience= sc.nextInt();
System.out.print("exam score = ");
double actScore= this.calculateActScore(actEng,actMath,actReading,actScience);
System.out.print(actScore);
System.out.print("overall GPA ?");
double actOverallGpa= sc.nextDouble();
System.out.print("max GPA ?");
double actMaxGpa= sc.nextDouble();
System.out.print("Transcript multiplier?");
double actTraScrMul= sc.nextDouble();
System.out.print("GPA score?");
double gpa = this.calculateGpa(actOverallGpa,actMaxGpa,actTraScrMul);
double resultAct = this.getResult(actScore,gpa)
System.out.print("second applicant over all score = "+resultAct);
}
if(resultSat > resultAct){
System.out.print("First Applicatnt seems to be bettr ");
} else if(resultSat < resultAct){
System.out.print("Second Applicatnt seems to be bettr ");
}else{
System.out.print("The two applicants seems to be equal ");
}
}
public double calculateSatScore(satMath,satCriticalReading,satWriting){
double satScore=((2*satMath)+satCriticalReading+satWriting)/32;
return satScore;
}
public double calculateGpa(OverallGpa,MaxGpa,TraScrMul){
double gpa= (OverallGpa/MaxGpa)*100*TraScrMul;
return gpa;
}
public double calculateActScore(actEng,actMath,actReading,actScience){
double actScore= ( actEng+(2*actMath)+actReading+actScience)/1.8;
return actScore;
}
public double getResult(examScore,gpa){
double totalScore=examScore+gpa ;
return totalScore;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.