At Mr. G school of Programming, the final school fees to be paid is calculated as follows.
Write a program the calculates the final total fees to be paid.
Program must request user to enter original fees value greater then R50 000.
Program should also request user to enter amount to deposit before calculating final total fees.
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Enter details for character 1");
System.out.print("Enter attr11: ");
int attr11=sc.nextInt();
System.out.print("Enter attr21: ");
String attr21=sc.next();
System.out.println("Enter details for character 2");
System.out.print("Enter attr12: ");
int attr12=sc.nextInt();
System.out.print("Enter attr22: ");
String attr22=sc.next();
int compare = attr21.compareToIgnoreCase(attr22);
if (attr11>attr12 && compare>0){
System.out.println("Character 1 has won");
}
else{
System.out.println("Character 2 has won");
}
}
}
Comments
Leave a comment