🔒 Closed Quad Kill

Status
Not open for further replies.

chaekayeon

Grasshopper
1642504938988.webp

1642504953873.webp
1642504966810.webp


Meron po bang nakakaalam po nito?
 
Java:
import java.util.Scanner;

class Quadrilateral {
  public void showDescription() {
    System.out.println("- is quadrilateral");
  }
}

class Rectangle extends Quadrilateral {
  public void showDescription() {
    System.out.println("- has 4 right angles");
    super.showDescription();
  }
}

class Square extends Rectangle {
  public void showDescription() {
    System.out.println("- has 4 equal sides");
    super.showDescription();
  }
}
class RunQuad {
  public static void main(String[] args) {
 
  Scanner sc = new Scanner(System.in);
 
    System.out.println("Press R for Rectangle or S for Square.");
    String userInput = sc.nextLine();
   
    Quadrilateral newRec = new Rectangle();
    Rectangle newSqua = new Square();
   
        if(userInput.equalsIgnoreCase("R")){
            System.out.println("A Rectangle:");
            newRec.showDescription();
        }
        else if(userInput.equalsIgnoreCase("S")){
            System.out.println("A Square:");
            newSqua.showDescription();
        }
  }
}

follow mo nalang kung pano ko ginawa. punta ka d2 You do not have permission to view the full content of this post. Log in or register now. kung need mo malaman kung pano.

try mo ikaw ang gumawa sa part 2.
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 2K
    Views
  • 4
    Participants
Last reply from:
Nielamae

Online now

Members online
959
Guests online
881
Total visitors
1,840

Forum statistics

Threads
2,276,251
Posts
28,968,671
Members
1,231,183
Latest member
Highness08
Back
Top