عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 12-10-2012, 03:31 AM   #7

عاشق الحاسب

جامعي

الصورة الرمزية عاشق الحاسب

 
تاريخ التسجيل: May 2008
التخصص: علوم الحاسب
نوع الدراسة: ماجستير
المستوى: متخرج
الجنس: ذكر
المشاركات: 42
افتراضي رد: الله يخليكم ساعدوني مو فااااااهمة

تكملة سؤال الاخت مستجدة.. طبعا هذا مجود شخصي وقد اصيب او اخطا.. بالتوفيق للجميع
تنبيه الرجاء الانتباه ومراجعة الكود كامل ومحاولة التغيير حتى لاتكون الاجابات متشابهه

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package javaapplication2;
import java.util.Scanner;

/
*
* @author ahmed ali
*/
public class JavaApplication2 {

/
* @param args the command line arguments
*/
public static void main(String[] args) {
final int COVERAGE = 350; //paint covers 350 sq ft/gal
int length, width,height; //declare integers length, width, and height;
double totalSqFt; //declare double totalSqFt;
double paintNeeded; //declare double paintNeeded;
int doors,windows; //number of doors and windows
double room_withNo_windows,room_withNo_doors,final_total; //total without doors and windows
Scanner sc = new Scanner(System.in);

System.out.println( "Please enter the length of the room: " );
length = sc.nextInt();

System.out.println( "Please enter the width of the room: " );
width = sc.nextInt();

System.out.println( "Please enter the height of the room: " );
height = sc.nextInt();

totalSqFt=(2*length*height)+ (2*width*height);//Compute the total square feet to be painted

paintNeeded= totalSqFt / COVERAGE;//Compute the amount of paint needed

System.out.printf("\nThe length of the room is %d",length);
System.out.printf("\nnThe width of the room is %d",width);
System.out.printf("\nThe height of the room is %d",height);

System.out.printf("\nThe number of gallons of paint needed is %f",paintNeeded," gallons. \n");
System.out.printf(" so you have to purchase %.0f",Math.ceil(paintNeeded)," gallons. \n");


System.out.println( "\nPlease enter the number of doors in the room: " );
doors = sc.nextInt();
room_withNo_doors = doors *20;
System.out.println( "Please enter the number of windows in the room: " );
windows= sc.nextInt();
room_withNo_windows = windows * 15;

final_total = room_withNo_doors+room_withNo_windows;
final_total= final_total/COVERAGE;
paintNeeded = paintNeeded - final_total;
System.out.printf("\nThe number of gallons of paint needed is %.0f",Math.ceil(paintNeeded)," gallons. \n");

}
}

 

عاشق الحاسب غير متواجد حالياً   رد مع اقتباس