Advertisement
avidris02

Rumus

Sep 27th, 2022
940
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.29 KB | Source Code | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package mainmenu;
  7. import java.util.*;
  8. /**
  9.  *
  10.  * @author Rae
  11.  */
  12. public class Rumus {
  13.     Scanner re = new Scanner(System.in);
  14.     public void persegiPanjangRumus() {
  15.         int p,l;
  16.         persegiPanjang pp = new persegiPanjang();
  17.         System.out.println("Rumus Luas Bangun Persegi Panjang");
  18.         System.out.print("Masukkan Panjang :");
  19.         p = re.nextInt();
  20.         System.out.print("Masukkan Lebar : ");
  21.         l = re.nextInt();
  22.         pp.setPanjang(p);
  23.         pp.setLebar(l);
  24.         pp.setLuas();
  25.         System.out.println("Luas Persegi Panjang = "+ pp.getLuas());
  26.         System.out.println("");
  27.     }
  28.     public void SegitigaRumus() {
  29.         double a,t;
  30.         Segitiga s = new Segitiga();
  31.         System.out.println("Rumus Luas Bangun Segitiga");
  32.         System.out.print("Masukkan Alas :");
  33.         a = re.nextDouble();
  34.         System.out.print("Masukkan Tinggi : ");
  35.         t = re.nextDouble();
  36.         s.setAlas(a);
  37.         s.setTinggi(t);
  38.         s.setLuas();
  39.         System.out.println("Luas Segitiga = "+ s.getLuas());
  40.         System.out.println("");
  41.     }
  42.     public void LingkaranRumus() {
  43.         double r;
  44.         Lingkaran l = new Lingkaran();
  45.         System.out.println("Rumus Luas Bangun Lingkaran");
  46.         System.out.print("Masukkan Jari-jari :");
  47.         r = re.nextDouble();
  48.         l.setJari(r);
  49.         l.setLuas();
  50.         System.out.println("Luas Lingkaran = "+ l.getLuas());
  51.         System.out.println("");
  52.     }
  53.     public void BalokRumus() {
  54.         int p,l,t;
  55.         Balok b = new Balok();
  56.         System.out.println("Rumus Luas Bangun Balok");
  57.         System.out.print("Masukkan Panjang : ");
  58.         p = re.nextInt();
  59.         System.out.print("Masukkan Lebar : ");
  60.         l = re.nextInt();
  61.         System.out.print("Masukkan Tinggi : ");
  62.         t = re.nextInt();
  63.         b.setPanjang(p);
  64.         b.setLebar(l);
  65.         b.setTinggi(t);
  66.         b.setVolume();
  67.         System.out.println("Volume Balok = "+ b.getVolume());
  68.         System.out.println("");
  69.     }
  70.     public void PrismaRumus() {
  71.         float a,t,tp;
  72.         Prisma p = new Prisma();
  73.         System.out.println("Rumus Luas Bangun Prisma Segitiga");
  74.         System.out.print("Masukkan Alas : ");
  75.         a = re.nextInt();
  76.         System.out.print("Masukkan Tinggi Segitiga : ");
  77.         t = re.nextInt();
  78.         System.out.print("Masukkan Tinggi Bangun : ");
  79.         tp = re.nextInt();
  80.         p.setAlas(a);
  81.         p.setTinggiS(t);
  82.         p.setTinggiP(tp);
  83.         p.setVolume();
  84.         System.out.println("Volume Prisma Segitiga = "+ p.getVolume());
  85.         System.out.println("");
  86.     }
  87.     public void TabungRumus() {
  88.         float r,t;
  89.         Tabung tb = new Tabung();
  90.         System.out.println("Rumus Luas Bangun Tabung");
  91.         System.out.print("Masukkan Jari-jari : ");
  92.         r = re.nextInt();
  93.         System.out.print("Masukkan Tinggi : ");
  94.         t = re.nextInt();
  95.         tb.setJari(r);
  96.         tb.setTinggi(t);
  97.         tb.setVolume();
  98.         System.out.println("Volume Tabung = "+ tb.getVolume());
  99.         System.out.println("");
  100.     }
  101. }
  102.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement