Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions 47 LawnMowing.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import java.util.Scanner;
public class LawnMowing{
public static void main ( String [] args){

Scanner input = new Scanner (System.in);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lines must be indent.

System.out.print ("Lawn-mowing service");
System.out.print (" \n Please Enter the Length and Width of your lawn: ");
System.out.print ("\n Length: ");
double length = input.nextDouble();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct the indent according to the lines above.

System.out.print ("Width: ");
double width = input.nextDouble();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lines must be indent according to the main-method.

System.out.print ("How would you like to set up a payment? \n (1) once, (2) twice, (3) 20 times per year");
int payment = input.nextInt();

double lawn = length*width;
double wcost = 0.0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lines must be indent according to the main-method.

if (lawn < 4000) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent, too.

wcost = 25;}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the curly brace in the next line.

else if (lawn >= 4000 && lawn < 6000) {
wcost = 35;}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the curly brace in the next line.

else {
wcost = 50;}
double costt = wcost*20;
double costp = 0.0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put in comments in your code. Because your code would more readable.


if ( payment == 1) {
costp = costt;}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the curly brace in the next line.

else if (payment == 2) {
costp = (costt/2);}
else if (payment == 20) {
costp = (costt/20);}


System.out.printf (" \n Your lawn is %.2f ", lawn);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent this lines according to the main-method.
Java code style conventions: http://www.oracle.com/technetwork/java/codeconvtoc-136057.html

System.out.print (" square feet.");
System.out.printf ("\n your weekly fee: %.2f", wcost);
System.out.printf ("\n 20-week seasonal fee: %.2f", costt);
System.out.print ("\n your payment is a " + payment);
System.out.printf(" time fee %.2f", costp);






}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last curly brace in the next line.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.