Instructions PoDjava GrainCalculator.java New Today we are working with basic methods Farmer loe wants you to help him determine how much grain he can expect to harvest this year, based on a formula that he has put together You will need to create a method called 'calculateGrain within the "Grain Calculator java class. This new method will make his calculations for him Details Input public class GrainCalculator { public GrainCalculator() { // Create the calculatecrain sethod here! // Hint: dividing by 1000 might give 11 4 different result than dividing by 1000.0 The input for this program is handled for you. Processing You will need to create a new method within the "GrainCalculator java class This method will be called 'calculateGrain, make sure you get the name right! Here are some details on the GrainCalculator dass 12 GrainCalculator int: calculateGrain (int, int, As you can see, this class is very simplistic: We will take care of the instantiation of this class, the input, and calling the method for you. All you need to do is write the calculateGrain method in the space provided. The calculateGrain method takes in 3 integers as input int width of grain field int-length of grain field int rainfall this year (in millimeters) It then makes a simple calculation to determine how much grain fin pounds) will be harvested, and returns the result as an integer The calculation is as follows expectedGrain-width length rainfall/1000) The value of expectedGrain is then returned Remember, we want to return an Int so you might need to convert your result to an integer before returning it! Output The output is already handled for you, tor Sample Input/output you, too. An example is shown below. Input: (handled for you!) 200 300 1100 Processing for this example: expectedGrain-200 300 1100/10001-660000 convert 66000 0 to 66000 and retum that value Output (also handled for you!): Farmer Joe has a grain field with a width of 200 meters and a length of 300 meters There was about 1100mm of rainfall this year Farmer Joe can expect about 66000 kilograms of grain this year. GrainCalculator.java PoDjavaⒸ import java.util.Scanner; New public class POD ( pulitic static void main(String[] args) { Scanner input her Scanner (System.in); in width input.nextInt(); int length input.nextInt(); Int rainfall input.nextInt();) GrainCalculator grainCalculator How GrainCalculator(); In expectedGrain grainCalculator.calculateGrain(width, length, rainfall); System.out.println("Farmer Joe has a grain field with a width of "width" meters and a length of "length" meters."); System.out.println("There was about "rainfall-"mm of rainfall this year."); System.out.println("Farmer Joe can expect about " expectedGrain" kilograms of grain this year.");  Please give proper explanation and typed answer only.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Instructions

PoDjava

GrainCalculator.java

New

Today we are working with basic methods Farmer loe wants you to help him determine how much grain he can expect to harvest this year, based on a formula that he has put together You will need to create a method called 'calculateGrain within the "Grain Calculator java class. This new method will make his calculations

for him

Details

Input

public class GrainCalculator {

public GrainCalculator() {

// Create the calculatecrain sethod here!

// Hint: dividing by 1000 might give

11 4 different result than dividing by 1000.0

The input for this program is handled for you.

Processing

You will need to create a new method within the "GrainCalculator java class This method will be called 'calculateGrain, make sure you get the name right! Here are some details on the GrainCalculator dass

12

GrainCalculator

int: calculateGrain (int, int,

As you can see, this class is very simplistic: We will take care of the instantiation of this class, the input, and calling the method for you. All you need to do is write the calculateGrain method in the space provided.

The calculateGrain method takes in 3 integers as input

int width of grain field

int-length of grain field int rainfall this year (in millimeters)

It then makes a simple calculation to determine how much grain fin pounds) will be harvested, and returns the result as an integer The calculation is as follows expectedGrain-width length rainfall/1000)

The value of expectedGrain is then returned Remember, we want to return an Int so you might need to convert your result to an integer before returning it!

Output The output is already handled for you, tor Sample Input/output you, too. An example is shown below.

Input: (handled for you!)

200

300

1100

Processing for this example:

expectedGrain-200 300 1100/10001-660000 convert 66000 0 to 66000 and retum that value

Output (also handled for you!): Farmer Joe has a grain field with a width of 200 meters and a length of 300 meters

There was about 1100mm of rainfall this year

Farmer Joe can expect about 66000 kilograms of grain this year.

GrainCalculator.java

PoDjavaⒸ

import java.util.Scanner;

New

public class POD (

pulitic static void main(String[] args) {

Scanner input her Scanner (System.in); in width input.nextInt();

int length input.nextInt(); Int rainfall input.nextInt();)

GrainCalculator grainCalculator How GrainCalculator(); In expectedGrain grainCalculator.calculateGrain(width, length, rainfall);

System.out.println("Farmer Joe has a grain field with a width of "width" meters and a length of "length" meters."); System.out.println("There was about "rainfall-"mm of rainfall this year."); System.out.println("Farmer Joe can expect about " expectedGrain" kilograms of grain this year."); 

Please give proper explanation and typed answer only.

 

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education