Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- // 3.1
- /* 1
- Scanner scan = new Scanner(System.in);
- System.out.println("Enter grade");
- float x = scan.nextFloat();
- //double x = scan.nextDouble();
- if(x >= 5.5) {
- System.out.println("Excellent");
- }else {
- System.out.println("Not excellent");
- }
- */
- /* 2
- Scanner scan = new Scanner(System.in);
- int number = scan.nextInt();
- if(number % 2 == 0) {
- System.out.println("Even");
- }else {
- System.out.println("odd");
- }
- */
- /*
- Scanner s = new Scanner(System.in);
- String text = s.next().toLowerCase()
- int lengthText = text.length();
- System.out.println(text.charAt(lengthText));
- */
- /*
- Scanner s = new Scanner(System.in);
- int n1 = s.nextInt();
- int n2 = s.nextInt();
- int n3 = s.nextInt();
- if(n1 == n2 && n1 == n3) {
- System.out.println("yes");
- }else {
- System.out.println("no");
- }
- */
- Scanner s = new Scanner(System.in);
- String figure = s.next();
- if(figure.equals("square")) {
- int site = s.nextInt();
- int result = site * site;
- System.out.println(result);
- }else if(figure.equals("rectangle")) {
- double rectLenght = s.nextDouble();
- double rectSize = s.nextDouble();
- System.out.println(rectLenght * rectSize);
- }else if(figure.equals("circle")) {
- // p * r * r
- }else if(figure.equals("triangle")) {
- // site * height
- }else {
- System.out.println("Invalid figure");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement