44.0k views
3 votes
Write a program that reads in the length and the width of a rectangular yard . your program should compute the time required ( in minutes ) to cut the grass at the rate of 2.3 square meters a second

I just want to know the equation that i need

User Caesium
by
7.8k points

1 Answer

6 votes
import javax.swing.*;
public class Grass { public static void main(String[]args) { // Variable declarations String gd; Double st, st2, st3, st4, time; for(int i=1; i<=5; i++) { // Get user input gd = JOptionPane.showInputDialog("Enter the length of yard"); st = Double.parseDouble(gd); st2 = Double.parseDouble(JOptionPane.showInputDialog("Enter the width of yard")); st3 = Double.parseDouble(JOptionPane.showInputDialog("Enter the length of house")); st4 = Double.parseDouble(JOptionPane.showInputDialog("Enter the width of house")); //Calculate time=(st * st2 - st3 * st4)/2.3; // Display the result System.out.println("The time required (in minutes) to cut the grass: "+time); } } // end of main} // end of grass
User Sawo Cliff
by
8.0k points

No related questions found