0% found this document useful (0 votes)
21 views1 page

Java Test

The document contains code for two Java programs that use if/else statements to check exam and quiz grades and verify if a user is above or below the legal age.

Uploaded by

Sheryl Alta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

Java Test

The document contains code for two Java programs that use if/else statements to check exam and quiz grades and verify if a user is above or below the legal age.

Uploaded by

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

COPY THE PROGRAM LEGIBLY (STRICTLY NO ERASURES/MISTAKES)

COMPUTE GRADE
import java.util.Scanner;
class grade {
public static void main (String[] args)
{
Scanner scan = new Scanner (System.in);
System.out.print ("Enter Exam Grade: ");
int eGrade = scan.nextInt();
System.out.println ();

if (eGrade < 60)


System.out.println("We have a problem");
else
System.out.println("Ok");
System.out.print ("Enter Quiz Grade: ");
int qGrade = scan.nextInt();

if (qGrade < 10)


System.out.println("We have a real problem");
else
System.out.println("Ok");

}
}

IF ELSE STATEMENT
import java.util.Scanner;
class ifElse {
public static void main (String[] args)
{
int MINOR = 21;

Scanner scan = new Scanner(System.in);

System.out.print ("Enter your age: ");


int age = scan.nextInt();

System.out.println ("You entered: " + age);

if (age < MINOR)


System.out.println ("Youth is a wonderful thing. " + "Enjoy.");

System.out.println("Age is a state of mind.");


}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy