Question: Programming package lab06;;public class gradereport { public static void main(String[] args) { Scanner in = new Scanner(System.in);double[] Scores = new double[10]; for(int i=0;i <10;i++){ System.out.println(Enter
Programming
package lab06;;public class gradereport {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);double[] Scores = new double[10];
for(int i=0;i<10;i++){
System.out.println("Enter score " + (i+1));scores[i]=in.nextdouble();
}
for(int i=0;i<10;i++){
if (scores[i] >=80)
System.out.println("Score " + (i+1) + " receives a grade of HD");
else if (scores[i]>=70)
System.out.println("Score " + (i+1) + " receives a grade of D");
else if (scores[i] >=60)
System.out.println("Score "+ (i+1) + " receives a grade of C");
else if (scores[i] >=50)
System.out.println("Score " + (i+1) + " receives a grade of P");
else if (scores[i] >=40)
System.out.println("Score " + (i+1) + " receives a grade of MF");
else if (scores[i] >=0)
System.out.println("Score " + (i+1) + " receives a grade of F");
else
System.out.println("Score " + (i+1) + " was invalid!");
}}}
- Find and remove errors from above above.
- Improve the quality of code by following programming standards from above.
// Airline.java - This program determines if an airline passenger is
// eligible for a 25% discount.
import java.util.Scanner;
public class Airline
{
public static void main(String args[])
{
Scanner s = new Scanner(System.in);
String passengerName = ""; // Passenger's name.
int passengerAge = 0; // Passenger's age.
System.out.println("Enter passenger's name: ");
passengerName = s.nextLine();
System.out.println("Enter passenger's age: ");
passengerAge = s.nextInt();
// Test to see if this customer is eligible for a 25% discount.
if(passengerAge <=6 || passengerAge >= 65)
{
System.out.println("Passenger name: " + passengerName);
System.out.println("Passenger age : " + passengerAge);
System.out.println("This passenger is eligible for a 25% discount.");
}
else
{
System.out.println("Passenger name: " + passengerName);
System.out.println("Passenger age : " + passengerAge);
System.out.println("This passenger is not eligible for a 25% discount.");
}
// This is the work done in the endOfJob() method
System.exit(0);
}
}
- Document and implement at least two different test cases following the format given below from above.
| Test case ID | Test case | Test Data | Expected Outcome | Actual Outcome |
|
|
|
|
|
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
