Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that reads the consumer's full name, his/her age, and his/her occupation from the console and prints out all pieces of data

image text in transcribed

Write a Java program that reads the consumer's full name, his/her age, and his/her occupation from the console and prints out all pieces of data related to a consumer, i.e. name, age, and occupation, in one line of the output console. The program prompts the consumer to enter the weight and price of package 1 , then does the same for package 2 , and displays the results to indicate which package has a worst unit price of the same material. It is assumed that the weight of all packages is measured in lb. The program should check to be sure that both the inputs of weight and price are both positive values. If not, program tells the consumer that inputs are invalid. Sample Run: Consumer info: John Smith Age: 36 Occupation: Farmer Weight and price of package 1:1.510 Weight and price of package 2:2.515 Package 1 has a worst unit price! Deliverables: Your .java file including: 1. A sample run at the top where consumer is Harry Potter (who is an 11 year old wizard) and 0.8lb package of every flavor beans is $4.5 (package 1) and 0.33lb package of every flavor beans is $2 (package 2). The four lines of the output (similar to those shown in the sample run above) should be inserted as a comment on the top of the Java code (before the import and class statements). (2 points) 2. Your code with other appropriate comments. (Code: 6 points, Comments: 2 points)

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_2

Step: 3

blur-text-image_3

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

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

14-13: When are people mostand leastlikely to help?

Answered: 1 week ago