import javax.swing.
public class First
{
public static void main(String args[])
{
House house = new House();
Yard yard = new Yard();
house.length = Integer.parseInt(
house.width = Integer.parseInt(
house.area = house.length * house.width;
yard.length = Integer.parseInt(
yard.width = Integer.parseInt(
yard.area = house.area - (yard.length * yard.width);
// I don't understand the formula
// timecutting = yard.area / 2.3
JOptionPane.
//okay, just fix the rest!
}
}
class House
{
int length;
int width;
int area;
int timecutting;
public House()
{
length = 0;
width = 0;
area = 0;
timecutting = 0;
}
}
class Yard
{
int length;
int width;
int area;
public Yard()
{
length = 0;
width = 0;
area = 0;
}
}
tdtech.co.cc
--- In Java_Official@
>
> Q. Write a Java program that reads in the length and width of a rectangular yard and the length and the width of a rectangular house situated in the yard. Your program should compute the time required (In minutes) to cut the grass at the rate of 2.3 square meters a second.
> Output Format:
> Yard Length: ________
> Yard width: _________
> Yard Area: ________
> House Length: ________
> House Width: ________
> House Area: _________
> Grass Area: __________
> Cutting Time: ________
>
> The above is the question of my assignment and I have came up with below algorithm.
> 1 Input the length of yard
> 2 Input the width of yard
> 3 Input the length of house
> 4 input the width of the house
> 5 Area of the House à Length of the house * Width of the house
> 6 Area of the Yard à Area of the house â" (Length of the yard * Width of the yard)
> 7 Time Required cutting the grass à Area of yard/2.3 m. square/sec/60
> 8 Print Times
>
> I tried really hard to write program but I donât know I am having problem and I canât get it correct. Well this is my first ever java assignment so I found it little hard for me. So if you please can help me writing the program.
>
> Regards, ------------
> Preyas Patel
> B.S. Computer Science
> California State University, Northridge
> + 1 619 200 4818
> patelpreyasi@
> patelpreyas2@
>
>
> From cricket scores to your friends. Try the Yahoo! India Homepage! http://in.yahoo.
>
> [Non-text portions of this message have been removed]
>
Java Official Group is created for the following topics: Java 2 Enterprise Edition - J2EE, Java 2 Standard Edition - J2SE, Java 2 Micro Edition - J2ME, XML, XSL, XSD, XPATH, Web Services, Jini, JXTA for all type of Java Geeks.
Whoever posts spam / ads / job related message will be BANNED IMMEDIATELY
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch format to Traditional
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
No comments:
Post a Comment