Understanding if-elseStatements Summary In this lab, you will complete a prewritten Java program that computes the largest and...

70.2K

Verified Solution

Question

Programming

Understanding if-elseStatements

Summary

In this lab, you will complete a prewritten Java program thatcomputes the largest and smallest of three integer values. Thethree values are –50, 53, and78.

Instructions

  1. Two variables named largest and smallest are declared for you.Use these variables to store the largest and smallest of the threeinteger values. You must decide what other variables you will needand initialize them if appropriate.
  2. Write the rest of the program using assignment statements, ifstatements, or if-else statements as appropriate. There arecomments in the code that tell you where you should write yourstatements. The output statement is written for you.
  3. Execute the program. Your output should be:
The largest value is 78The smallest value is −50

Grading

When you have completed your program, click theSubmit button to record your score.

// LargeSmall.java - This program calculates the largest andsmallest of three integer values.


public class LargeSmall

{

public static void main(String args[])

{

// This is the work done in the housekeeping() method

// Declare and initialize variables here.

int largest; // Largest of the three values.

int smallest; // Smallest of the three values.

// This is the work done in the detailLoop() method

//Write assignment, if, or if else statements here asappropriate.

// This is the work done in the endOfJob() method

// Output largest and smallest number.

System.out.println(\"The largest value is \" + largest);

System.out.println(\"The smallest value is \" + smallest);

}

}

Answer & Explanation Solved by verified expert
4.3 Ratings (494 Votes)
import javautilScannerpublic class LargeSmall public static void mainString args This is the work done in the housekeeping method Declare and    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students