Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Integers lemonGrams 1 , lemonGrams 2 , lemonGrams 3 , and numAdults are read from input. Compute the average grams of lemons each adult receives

Integers lemonGrams1, lemonGrams2, lemonGrams3, and numAdults are read from input. Compute the average grams of lemons each adult receives using floating-point division, and assign the result to averageGrams.
Ex: If the input is 300194178,2, then the output is:
336.0
import java.util. Scanner;
public class SleepStatistics {
public static void main(String[] args){
Scanner scnr = new Scanner(
System.in);
int lemonGrams1;
int lemonGrams2;
int lemonGrams3;
int numAdults;
double averageGrams;
lemonGrams1= scnr. nextInt ();
lemonGrams2=scnr. nextInt();
lemonGrams 3=scnr. nextInt ();
numAdults = scnr . nextInt () ;
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions