Results 21 to 27 of 27
- 04-16-2009, 09:05 AM #21
Member
- Join Date
- Apr 2009
- Location
- Pretoria, Gauteng, South Africa
- Posts
- 43
- Rep Power
- 0
- 04-16-2009, 10:27 AM #22
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
read post 15 in detail...
Fubarable gave you the answer...
-
- 04-16-2009, 08:05 PM #24
Member
- Join Date
- Apr 2009
- Posts
- 34
- Rep Power
- 0
ok hold on, let me look at the code and try to ask a specific question. if i can.
- 04-23-2009, 04:21 AM #25
Member
- Join Date
- Apr 2009
- Posts
- 34
- Rep Power
- 0
finnallly i got it guys...thanx for da help, but i did most of the reading so,,thanxxx...50/50
thanxs chris and fubarable, mainly chris....
heres da code../* This program calculates the number of gallons of paint
needed to paint a room.
Programmer:me
Date:
*/
import java.util.Scanner;
public class PaintersHelpersSplit {
static float DOOR_SIZE = 15.0f;
static float SMALL_WINDOW_SIZE =2.0f;
static float LARGE_WINDOW_SIZE = 5.0f;
static float SQ_FT_PER_GALLON = 375.0f;
static float netsquarefeet;
static float grosssquarefeet;
// declare all variables to be used
public static void main(String[] args) {
int height,length,width, doors, smwindows, lgwindows;
int gallons;
// give welcome and instructions to user
System.out.println("Welcome to the painters Helper");
Scanner input = new Scanner (System.in);
// prompt user for the room's width
System.out.println("Please enter the room's width:");
width = input.nextInt();
// prompt user for the room's length
System.out.println("Please enter the room's length:");
length = input.nextInt();
// prompt user for the room's height
System.out.println("Please enter the room's height:");
height = input.nextInt();
// prompt user for the number of doors
System.out.println("Please enter the number of doors:");
doors = input.nextInt();
// prompt user for the number of small windows
System.out.println("Please enter the the number of small windows:");
smwindows = input.nextInt();
// prompt user for the number of large windows
System.out.println("Please enter the number of large windows:");
lgwindows = input.nextInt();
gallons = computeGallons(length, height, doors, width, lgwindows, smwindows);
System.out.println("You will need about " + gallons + "gallons of paint for your room.");
} // end of method main
static int computeGallons(int length, int height, int doors, int width, int lgWindows, int smWindows) {
float grosssquarefeet, subtraction,netsquarefeet;
int gallons;
// gross square feet = height * 2 * (length + width)
grosssquarefeet = height * 2 * ( length + width);
// net square feet = gross square feet - subtractions
subtraction = (doors * DOOR_SIZE) + (lgWindows * LARGE_WINDOW_SIZE) + (smWindows * SMALL_WINDOW_SIZE);
netsquarefeet = grosssquarefeet - subtraction;
// gallons = netSqFt / SQ_FT_PER_GALLON rounded to the nearest gallon
gallons = Math.round(netsquarefeet / SQ_FT_PER_GALLON);
return gallons;
} // end of computegGallons
} // end of class PaintersHelper
- 04-23-2009, 04:27 AM #26
Hey, that's great !!! Go Team Go....
Luck,
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 04-23-2009, 04:30 AM #27
Member
- Join Date
- Apr 2009
- Posts
- 34
- Rep Power
- 0
Similar Threads
-
I couldn’t figure out how to do this please help!
By afrttoh in forum New To JavaReplies: 5Last Post: 11-19-2008, 08:21 PM -
Cannot figure out min and max, without using arrays. if possible.
By loddog2002 in forum New To JavaReplies: 2Last Post: 11-08-2008, 04:58 AM -
Please Help, can't figure out what I'm doing wrong.
By tamik0 in forum New To JavaReplies: 2Last Post: 07-11-2008, 09:41 AM -
Seems so simple yet I can't figure it out!
By adamhaviland in forum New To JavaReplies: 1Last Post: 11-03-2007, 06:26 PM -
I can't figure this out
By silvia in forum New To JavaReplies: 3Last Post: 07-20-2007, 04:38 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks