Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package sis;
- import java.text.DecimalFormat;
- import java.util.Scanner;
- public class Main {
- static Scanner console = new Scanner(System.in);
- static Scanner consoleDouble = new Scanner(System.in);
- static DecimalFormat numberFormat = new DecimalFormat("#.000");
- public static void main(String[] args) throws InterruptedException {
- String loginUname;
- String loginPword;
- String[] uname = new String[1000];
- String[] pword = new String[1000];
- String[] name = new String[1000];
- String[] bday = new String[1000];
- String choice;
- double computation;
- double[][] subjects = new double[1000][5];
- int x=0, y=0, z=0;
- boolean login = false, exit = false;
- do{
- do{
- System.out.printf("Do you want to [L]ogin or [S]ignup?: ");
- choice = console.next();
- choice = choice.toLowerCase();
- }while(!choice.equals("l")&&!choice.equals("s"));
- if (choice.equals("s")){
- System.out.println("Enter Login Details");
- System.out.printf("Enter Username: ");
- uname[z] = console.next();
- System.out.printf("Enter Password: ");
- pword[z] = console.next();
- System.out.printf("Enter your Full Name: ");
- name[z] = console.next();
- System.out.printf("Enter Birthday in Month/Day/Year: ");
- bday[z] = console.next();
- System.out.printf("Enter Grade for Programming (2 Units): ");
- subjects[z][0] = consoleDouble.nextDouble();
- System.out.printf("Enter Grade for Computing (3 Units): ");
- subjects[z][1] = consoleDouble.nextDouble();
- System.out.printf("Enter Grade for UTS (3 Units): ");
- subjects[z][2] = consoleDouble.nextDouble();
- System.out.printf("Enter Grade for STS (3 Units): ");
- subjects[z][3] = consoleDouble.nextDouble();
- System.out.printf("Enter Grade for PE (2 Units): ");
- subjects[z][4] = consoleDouble.nextDouble();
- z++;
- }
- else if (choice.equals("l")){
- System.out.println("Enter Login Details");
- System.out.printf("Enter Username: ");
- loginUname = console.next();
- for(x=0;x<1000;x++){
- if (loginUname.equals(uname[x])){
- x=y;
- }
- }
- System.out.printf("Enter Password: ");
- loginPword = console.next();
- if (loginPword.equals(pword[y])){
- login = true;
- }
- }
- if (login == true){
- System.out.println("Name: \t"+name[y]);
- System.out.println("Birthday: \t"+bday[y]);
- System.out.println("Grades");
- System.out.println("Programming: \t"+subjects[y][0]);
- System.out.println("Computing: \t"+subjects[y][1]);
- System.out.println("UTS: \t\t"+subjects[y][2]);
- System.out.println("STS: \t\t"+subjects[y][3]);
- System.out.println("PE: \t\t"+subjects[y][4]);
- computation = ( ((subjects[y][0]*2)+(subjects[y][1]*3)+(subjects[y][2]*3)
- +(subjects[y][3]*3)+(subjects[y][4]*2)) / 13 );
- System.out.print("GWA: \t"+numberFormat.format(computation));
- }
- do{
- System.out.printf("Do you want to exit? [Y]es / [N]o?: ");
- choice = console.next();
- choice = choice.toLowerCase();
- }while(!choice.equals("y")&&!choice.equals("n"));
- if (choice.equals("y"))
- exit=true;
- }while(exit==false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement