Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Briggs was not the name of a young woman, Watson, . . . It was a ship which is associated with the giant rat of

Briggs was not the name of a young woman, Watson, ... It was a ship which is associated with the giant rat of Sumatra, a story for which the world is not yet prepared:" Over a hundred years later, researchers found giant rats in Western New Guinea, another part of Indonesia.
(c) jeanma85/iStockphoto.
Suppose you are charged with writing a program that processes rat weights. We don't know for sure how giant a rat could be, but the New Guinea rats weighed no more than 2kg. A regular house rat (Rattus rattus) weighs up to 0.2kg, so we'll say that any weight >10kg was surely an input error, perhaps confusing grams and kilograms. Of course, inputs should be positive numbers. Rearrange the following lines of code to supply error handling.
How to use this tool
Unused
{
}
if (weight 0)
{
System.out.println("Error: Weight must be positive");
}
else
{
System.out.println("Processing weight...");
// Pracess weight
}
else
1
System.out.println("Error: no number input");
}
else if (weight >10)
RatWeight.java
Load default template...
import java.util.scanner;
public class Ratweight
{
public static void main (String [] args)
{
Scanner in = new Scanner(
System.in);
System.out.print("Enter weight in kg: ");
}
}
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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 1 Lnai 6321

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215879X, 978-3642158797

More Books

Students also viewed these Databases questions