2/19/2013

BCS1243 PP Lab 20 feb 2013 (selection)

1. Read three integers and find the largest.

import java.util.Scanner;
/**
 * @(#)tbsr3no.java
 *
 * tbsr3no application
 *
 * @author
 * @version 1.00 2013/2/20
 */

public class tbsr3no {
   
    public static void main(String[] args) {
       
        int N1,N2,N3,TBSR;
        Scanner input = new Scanner(System.in);
        N1 =input.nextInt();
        N2 =input.nextInt();
        N3 =input.nextInt();
       
        if(N1>N2)
        {
         TBSR=N1;   
        }
        else
        {
         TBSR = N2;
        }
  
      
           if(N3>TBSR)
           {
             TBSR=N3;
           }  
    
       System.out.println("Nilai tersebar antara 3 nilai ialah " + TBSR);
   
    }
}



2. Write a java program that reads the user’s age and then prints “you are a child” if the age <18 18="" adult="" age="" an="" and="" are="" citizen.="" if="" ou="" senior="" you="">=65. *(some characters not displayed correctly here)



import java.util.Scanner;
/**
 * @(#)age_and_status.java
 *
 * age_and_status application
 *
 * @author
 * @version 1.00 2013/2/20
 */

public class age_and_status {
   
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int Age;
        System.out.println("Sila masukkan umur!");
        Age =input.nextInt();
   
    
       
        if(Age<18 br="">        {
        System.out.println("you are a child");
        }
   
   
        if((Age>18)&&(Age<=65))
        {
        System.out.println("you are an adult");
        }
       
       
        if(Age>=65)
        {
        System.out.println("You are senior citizen");
        }
       
       
   
    }
}



3. A student’s letter grade is calculated according to the following schedule:
Numerical grade
Letter grade
90-100
A
80-89
B
70-79
C
60-69
D
0-59
F
Write a java  that accepts a student’s numerical grade, converts the numerical grade to an equivalent letter grade, and displays the letter grade. 

No comments:

Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...