Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author Adam Csatari
- */
- public class hazi {
- public static void main(String[] args) {
- double testmagassag;
- int testtomeg;
- //adatbekérés
- do {
- System.out.println("A testmagasság 100 és 200 cm között lehet csak ");
- testmagassag=extra.Console.readInt("Kérem a testmagasságot: ");
- } while (testmagassag<100 || testmagassag>200);
- System.out.println("");
- do {
- System.out.println("A testtomeg 40 és 150 kg között lehet csak ");
- testtomeg=extra.Console.readInt("Kérem a testtömeget: ");
- } while (testtomeg<40 || testtomeg>150);
- System.out.println("");
- //adatkiiratás
- System.out.println("Az Ön testmagassága: " +testmagassag + "cm");
- System.out.println("Az Ön testtömege: " +testtomeg + "kg");
- System.out.println("");
- //adatkonvertálás
- double hanyados = (double) (testmagassag /100);
- double negyzet= (double) (hanyados*hanyados);
- //testömegindex szamolas
- double index = (double) (testtomeg / negyzet);
- System.out.println("Az Ön testtömeg indexe: " + index + "kg/m2");
- //indexskala
- //20 alatt =sovány
- //20-25 között normál
- //25-30 között túlsúlyos
- //30-40 között elhízott
- //40 fölött kórosan elhízott
- if (index<20)
- {
- System.out.println("Sovány");
- }
- else if (index<25 & index>20)
- {
- System.out.println("Normál");
- }
- else if (index<30 & index>25)
- {
- System.out.println("Túlsúlyos");
- }
- else if (index<40 & index>30)
- {
- System.out.println("Elhízott");
- }
- else if(index>40)
- {
- System.out.println("Kórosan elhízott");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement