اذهب إلى المحتوى
  • 0

كيفية كتابة الكود

ندى سعيد2

السؤال

/* انا كتبت هذا الكود وكنت عاوزة اعرف ازاى اعمل متغير اسمه percentage لكل نوع من BMI  واجيب النسبة المئوية لكل نوع واطبع افضل مدينة وأسوء مدينة
 * 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.
 */

package javaapplication8;
import java.util.*;

public class JavaApplication8
{

    private static String nameofcity;
    private static String numberofpeople;

     
    public static void main(String[] args ) {
        Scanner input = new Scanner(System.in);
        
        
                   double percnormal;
double normal=0;
        int citynumbers;
        int peoplenumbers=0;
        int totalpeople=0;
        double peopleonoverweight=0,obese = 0;
        double peopleonnormalweight=0;
        double peopleonounderweight=0;
         System.out.println("Enter number of cities");
        citynumbers = input.nextInt();
        while ( citynumbers<6){
  System.out.println("wrong input");
    System.out.println("Enter the number of cities equal or big than 6");
    citynumbers = input.nextInt();
        }
        System.out.println("Enter your city name");
        nameofcity = input.next();
        System.out.println("Enter the number of people");
         numberofpeople=input.next();
        System.out.println("Enter person 1 weight");
        String person1 =input.next();
        System.out.println("Enter person 1 hight");
        String person1hight=input.next();
        System.out.println("Please Enter your name");
        String nameofuser=input.next();
        System.out.println("please Enter your weight");
        String yourweight=input.next();
         int city = 0;
        
        {
          System.out.println("enter your city name"); 
          String user=input.next();
        }
        double persons ;
        
        for (persons = 0; persons <= 10; persons++ ) {
            System.out.println("number of people");
        }
        double BMI;
        for ( BMI = 0; BMI <=16.5; BMI++ )
        {
            System.out.println("Enter your BMI");
            BMI=input.nextDouble();
            double mass;
            System.out.println("Enter your mass" );
            mass=input.nextDouble();
            double weight;
              System.out.println("Enter your weight" );
             weight=input.nextDouble();
             double height;
              System.out.println("Enter your height" );
             height=input.nextDouble();
             BMI=mass/(height*height);
             double underweight;
             underweight=input.nextDouble();
             if (BMI <16.5)
             {   
                 System.out.println("your BMI is underweight"+1);
             underweight+=1;
             }
             else if (BMI<25&& BMI>16.5){
                 
                 normal=(int) input.nextDouble();
                 System.out.println("your BMI is normal"+1);
                 normal=normal+1;
             }
             else if (BMI<30 && BMI>25){
                 double overweight;
                 overweight=input.nextDouble();
                 System.out.println("your BMI is overweight");
                 overweight=overweight+1;
             } 
             else if (BMI>=30){
 System.out.println("your BMI is obese");
                obese = obese+1;
              
                
            
                
                percnormal = (normal / peoplenumbers )*100;  
             
            

             }

 

تم التعديل في بواسطة عبدالباسط ابراهيم
تنسيق الكود
رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

لا توجد أي إجابات على هذا السؤال بعد

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...