Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 3.import java.util.*;
- public class Project3
- {
- public static void main(String [] args)
- {
- Scanner pikachu = new Scanner(System.in);
- System.out.print("Input information for Student #1");
- System.out.print("GPA:");
- double GPA1 = pikachu.nextDouble();
- System.out.print("SAT:");
- int SAT1 = pikachu.nextInt();
- if(SAT1 > 2400 || SAT1 < 600)
- {
- System.out.print("THAT IS AN INVALID SCORE");
- }
- System.out.print("ACT:");
- int ACT1 = pikachu.nextInt();
- if(ACT1 > 36 || ACT1 < 1)
- {
- System.out.print("THAT IS AN INVALID SCORE");
- }
- System.out.print("Input information for student #2");
- System.out.print("GPA:");
- double GPA2 = pikachu.nextDouble();
- System.out.print("SAT:");
- int SAT2 = pikachu.nextInt();
- if(SAT2 > 2400 || SAT1 < 600)
- {
- System.out.print("THAT IS AN INVALID SCORE");
- }
- System.out.print("ACT");
- int ACT2 = pikachu.nextInt();
- if(ACT2 > 36 || ACT1 < 1)
- {
- System.out.print("THAT IS AN INVALID SCORE");
- }
- double LargerScore1 = Compare1(SAT1, ACT1);
- double LargerScore2 = Compare2(SAT2, ACT2);
- double BetterStudent = Calculation(LargerScore1, LargerScore2, GPA1, GPA2);
- if(BetterStudent == LargerScore1+GPA1)
- {
- System.out.print("Student#1 is more qualified for this school");
- }
- else if(BetterStudent == LargerScore2+GPA2)
- {
- System.out.print("Student#2 is more qualified for this school");
- }
- else
- {
- System.out.print("Both Students are equally qualified");
- }
- // Program to compare the ratios between the student's SAT and ACT Score and send the bigger percentage
- }
- // Method to compare the ratios between the student#1's SAT and ACT Score and send the bigger percentage
- public static double Compare1(int SAT1, int ACT1)
- {
- double SATRatio1 = SAT1/2400;
- double ACTRatio1 = ACT1/36;
- if(SATRatio1 > ACTRatio1)
- {
- return SATRatio1;
- }
- else if(ACTRatio1 > SATRatio1)
- {
- return ACTRatio1;
- }
- //If the student recieved perfect scores for both then the method will return the ACT score.
- else
- {
- return ACTRatio1;
- }
- }
- // Method to compare the ratios between the student#2's SAT and ACT Score and send the bigger percentage
- public static double Compare2(int SAT2, int ACT2)
- {
- double SATRatio2 = SAT2/2400;
- double ACTRatio2 = ACT2/36;
- if(SATRatio2 > ACTRatio2)
- {
- return SATRatio2;
- }
- else if(ACTRatio2 > SATRatio2)
- {
- return ACTRatio2;
- }
- //If the student recieved perfect scores for both then the method will return the ACT score.
- else
- {
- return ACTRatio2;
- }
- }
- // Method to Calculate the larger Student Score
- public static double Calculation(double LargerScore1, double LargerScore2, double GPA1, double GPA2)
- {
- double Student1 = GPA1+LargerScore1;
- double Student2 = GPA2+LargerScore2;
- double equality = 0.0;
- if(Student1 > Student2)
- {
- return Student1;
- }
- else if(Student1 < Student2)
- {
- return Student2;
- }
- // If the students score's are equal
- else
- {
- return equality;
- }
- }
- }
- 4. import java.util.*;
- public class Project4
- {
- public static void main(String [] args)
- {
- Scanner pikachu = new Scanner(System.in);
- System.out.println("What is the current date");
- System.out.print("Numerical value for Month:");
- int Month1 = pikachu.nextInt();
- System.out.print("Day:");
- int Day1 = pikachu.nextInt();
- System.out.print("Input the Birthday for person #1");
- System.out.print("Numerical value for Month:");
- int Month2 = pikachu.nextInt();
- System.out.print("Day:");
- int Day2 = pikachu.nextInt();
- System.out.print("Intput the Birthday for person #2");
- System.out.print("Numerical value for Month");
- int Month3 = pikachu.nextInt();
- System.out.print("Day:");
- int Day3 = pikachu.nextInt();
- int absvdate1 = Calculation1(Month1, Day1);
- int absvdate2 = Calculation2(Month2, Day2);
- int absvdate3 = Calculation3(Month3, Day3);
- int daystill1 = Math.abs(absvdate2-absvdate1);
- int daystill2 = Math.abs(absvdate3-absvdate1);
- if(daystill1 > daystill2)
- {
- System.out.print("User #1 has the later birthdate");
- }
- else if(daystill2 > daystill1)
- {
- System.out.print("User #2 has the later birthdate");
- }
- else
- {
- System.out.print("Users have the same birthday");
- }
- System.out.println("Days until User #1 birthday:+"+daystill1);
- System.out.println("Days until User #2 birthday:+"+daystill2);
- }
- public static int Calculation1(int Month1, int Day1)
- {
- if(Month1 == 2)
- {
- Month1 = 31;
- }
- else if(Month1 == 3)
- {
- Month1 = 59;
- }
- else if(Month1 == 4)
- {
- Month1 = 90;
- }
- else if(Month1 == 5)
- {
- Month1 = 120;
- }
- else if(Month1 == 6)
- {
- Month1 = 151;
- }
- else if(Month1 == 7)
- {
- Month1 = 181;
- }
- else if(Month1 == 8)
- {
- Month1 = 212;
- }
- else if(Month1 == 9)
- {
- Month1 = 243;
- }
- else if(Month1 == 10)
- {
- Month1 = 273;
- }
- else if(Month1 == 11)
- {
- Month1 = 304;
- }
- else if(Month1 == 12)
- {
- Month1 = 334;
- }
- int absvdate2 = Month1+Day1;
- return absvdate2;
- }
- public static int Calculation2(int Month2, int Day2)
- {
- if(Month2 == 2)
- {
- Month2 = 31;
- }
- else if(Month2 == 3)
- {
- Month2 = 59;
- }
- else if(Month2 == 4)
- {
- Month2 = 90;
- }
- else if(Month2 == 5)
- {
- Month2 = 120;
- }
- else if(Month2 == 6)
- {
- Month2 = 151;
- }
- else if(Month2 == 7)
- {
- Month2 = 181;
- }
- else if(Month2 == 8)
- {
- Month2 = 212;
- }
- else if(Month2 == 9)
- {
- Month2 = 243;
- }
- else if(Month2 == 10)
- {
- Month2 = 273;
- }
- else if(Month2 == 11)
- {
- Month2 = 304;
- }
- else if(Month2 == 12)
- {
- Month2 = 334;
- }
- int absvdate2 = Month2+Day2;
- return absvdate2;
- }
- public static int Calculation3(int Month3, int Day3)
- {
- if(Month3 == 2)
- {
- Month3 = 31;
- }
- else if(Month3 == 3)
- {
- Month3 = 59;
- }
- else if(Month3 == 4)
- {
- Month3 = 90;
- }
- else if(Month3 == 5)
- {
- Month3 = 120;
- }
- else if(Month3 == 6)
- {
- Month3 = 151;
- }
- else if(Month3 == 7)
- {
- Month3 = 181;
- }
- else if(Month3 == 8)
- {
- Month3 = 212;
- }
- else if(Month3 == 9)
- {
- Month3 = 243;
- }
- else if(Month3 == 10)
- {
- Month3 = 273;
- }
- else if(Month3 == 11)
- {
- Month3 = 304;
- }
- else if(Month3 == 12)
- {
- Month3 = 334;
- }
- int absvdate3 = Month3+Day3;
- return absvdate3;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment