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

عاشق الحاسب

جامعي

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

 
تاريخ التسجيل: 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;
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");
paintNeeded= Math.ceil(paintNeeded);
System.out.printf(" so you have to purchase %f",paintNeeded," gallons. \n");
}
}

 

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