programming

profilememe21
ex_3.docx

Sequential & Selection Structures

Lab Objectives:

This lab has been added to reinforce the ability of students to solve programming problems involving selection control structures. The objectives are:

1. Develop a Java code to solve programming problems involving selection control structures.

2. Use diverse selection control statements (e.g. IF, IF-Else, Nested IF-Else).

Special Instructions:

1. Please make sure to draw clear flowchart.

2. Please include the source code of your Java program.

Lab Exercise 3: (Airport):

Write the Java code for a program that reads the weight of a piece of luggage and print the proper message, depending on the weight, as per the table below.

Weight (Kg)

Printed message

weight

“Sorry, we cannot take a suitcase that heavy”

50 weight <

“There is a $25 charge for luggage that heavy”

weight <

"Thank you for your business."

Your program should read the weight and print the corresponding message, based on the above table.

ANSWER