What's new

Closed Pa tulong naman 😭

Status
Not open for further replies.
eto paps, pagaralan mo sana to,

Lab 08

Java:
class Employee {
    double salaray = 25000;
}

class Programmer extends Employee {
    int bonus = 10000;
   
    public static void main(String[] args) {
        Programmer p = new Programmer();
        System.out.println("Teacher Salaray is: "+p.salaray);
        System.out.println("Teacher Bonus is: "+p.bonus);
    }
}

Lab 09
Java:
import java.util.*;
    //class name is your choice
public class test2 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int minuend, subtrahend, difference;
        System.out.println("Enter Minuend: ");
        minuend = s.nextInt();
        System.out.println("Enter Subtrahend: ");
        subtrahend = s.nextInt();
        try {
            difference = minuend - subtrahend;
            System.out.println(minuend + " - " + subtrahend + " = " + difference);
        } catch (ArithmeticException ex) {
            // Im not sure kung anong dapat ilagay dito, as your professor didnt say any
            System.out.println(ex.getMessage());
            System.out.println("Try again.");
        }
        finally {
            System.out.println("Thank you.");
            s.close();
        }
    }
}

Lab 10
Java:
import java.util.Scanner;
//class name your choice
public class test2 {
    public static void main(String[] args) {
        //Not sure kung anong nakalagay sa line na to, ikaw na bahala
        Scanner scan = new Scanner(System.in);
        String name;
        System.out.println("Enter your name: ");
        name = scan.nextLine();
        System.out.println("Welcome, "+name);
        System.out.println("You will pass the prelim");
        scan.close();
    }
}
 
ito pa paps pa tulong naman po. gumana lahat na code na bininigay mo sobrang thank you tlaga..
Java:
public double weight, height, BodyMassIndex;
            //Your choice kung anung name ng void method
    public void setValue(double weight, double height) {
        this.weight = weight;
        this.height = height;
    }
    public void calculate() {
        BodyMassIndex = weight / (height * height);
    }
    public Boolean isOverWeight() {
        return (BodyMassIndex > 25);
    }
 
ayaw parin paps
1576069551386.png
 

Attachments

Status
Not open for further replies.

Similar threads

Back
Top