0% found this document useful (0 votes)
80 views5 pages

Ma. Marivic D. Olaso BSIT 112: Import Publicclass Publicstaticvoid New Double Double Double Double Double

The document contains code for three Java programs: 1) An average grade calculator that takes grades as user input and calculates the average. 2) A salary calculator that takes employee name, pay rate, hours worked as input and calculates salary. 3) A leap year checker that takes a year as input and determines if it is a leap year.

Uploaded by

Angel Geloso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views5 pages

Ma. Marivic D. Olaso BSIT 112: Import Publicclass Publicstaticvoid New Double Double Double Double Double

The document contains code for three Java programs: 1) An average grade calculator that takes grades as user input and calculates the average. 2) A salary calculator that takes employee name, pay rate, hours worked as input and calculates salary. 3) A leap year checker that takes a year as input and determines if it is a leap year.

Uploaded by

Angel Geloso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

Ma. Marivic D.

Olaso BSIT 112

Average Grade Calculator

importjava.util.Scanner;

publicclassAverageGradeCalculator {

publicstaticvoidmain(String[] args) {

Scanner Refactor = newScanner(System.in);

System.out.print("Enter your grade in Science ");


doubleGrade1 = Refactor.nextDouble();

System.out.print("Enter your grade in Math: ");


doubleGrade2 = Refactor.nextDouble();

System.out.print("Enter your grade in Filipino: ");


doubleGrade3 = Refactor.nextDouble();

System.out.print("Enter your grade in Science: ");


doubleGrade4 = Refactor.nextDouble();

System.out.print("Enter your grade in Physical Health: ");


doubleGrade5 = Refactor.nextDouble();
System.out.println("Average of five number is: " +
(Grade1 + Grade2 + Grade3 + Grade4 + Grade5) / 5);

}
Salary Calculator

importjava.util.Scanner;
publicclassSalary_Calculator {

publicstaticvoidmain(String[] args) {

Scanner scan = newScanner(System.in);

System.out.println("Please enter your full name:");


String Name = scan.nextLine();

System.out.println("Please enter your Pay Rate:");


doublePay = scan.nextDouble();

System.out.println("Please enter your total hours of work:");


doublehours = scan.nextDouble();
doublesalary = Pay * hours;

System.out.println("Employee Name: " + Name);


System.out.println("Pay Rate: " + Pay);
System.out.println("Hours of Work: " + hours);
System.out.println("The salary is: " + salary);
}
}
LEAP YEAR OR NOT

2020

2016
2012

2008
CODINGS
publicclassLeapYearOrNot {

publicstaticvoidmain(String[] args) {
intyear = 2008;
booleanleap = false;

if(year % 4 == 0)
{
if( year % 100 == 0)
{

if( year % 400 == 0)


leap = true;
else
leap = false;
}
else
leap = true;
}
else
leap = false;

if(leap)
System.out.println("The year " + year + " is a leap year.");

else
System.out.println("The year " +year + " is not a leap year.");

}
}

You might also like