Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a method showMultiples that takes three int arguments: int lower, int upper, int item, and displays the multiples of the number item in the

Define a method showMultiples that takes three int arguments: int lower, int upper, int item, and displays the multiples of the number item in the range of lower and upper, inclusively. In the main method, call the showMultiples method to output the multiples of 2 in the range of 1 and 100. output the multiples of 3 in the range of -20 and 20. output the multiples of 5 in the range of 1 and 1000.

Define a method named inputGPA that reads from keyboard a floating-point value as a GPA, validates and returns the value. A valid GPA is between 0 and 4.0. If the user input is invalid, asks the user to reenter the value until a valid GPA is entered. In the main method, call the inputGPA method and output the returned GPA value on the screen.

Below is the starter program code in java

public class Lab4 {

public static void main(String[] args) {

double f, c;

System.out.println("Helloooooooooo"); for (f = 0; f <= 104; f += 2) { c = convertCelsius(f); System.out.printf("%.2f \t %.2f ", f, c);

} showMultiples(-20,20,3); }

public static double convertCelsius(double f) {

return (f - 32) * 5 / 9; }

public static void showMultiples(int lower, int upper, int item) {

for (int i = lower; i <= upper; i++) { if (i % item == 0) { System.out.print(i + " "); } }

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

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions

Question

In Exercises 1118, solve each equation. 5 x = 1.4

Answered: 1 week ago

Question

Define Administration and Management

Answered: 1 week ago

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago