Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1: Rearrange - BooleanIf.java In the previous lab we discovered that there will always be 3 if statements that will be true for any

Part 1: Rearrange - BooleanIf.java In the previous lab we discovered that there will always be 3 if statements that will be true for any combination of two numbers (a and b). BooleanIf right now has 6 independent if statements to print out the true relations between the two numbers. It is redundant to have 6 checks as some expressions are related - if one is true then the other must be false and vice versa. We have 3 pairs of relations, which can be checked with 3 simple if-else statements. Modify BooleanIf.java to use only 3 if-else statements while preserving the same output and logic.

Part 2: Number.java Program asks the user to input a number between 1 and 26 (inclusive). Put in code to check if the input number is within the valid range (1-26) and print Character # of the alphabet is *, where # is the input number and * is a corresponding character with the following logic: If the input number is 1 then your code must output "Character 1 of the alphabet is A" If the input number is 2 then your code must output "Character 2 of the alphabet is B" ... so on ... If the input number is 26 then your code must output "Character 26 of the alphabet is Z" If the number is invalid, then your code must output "Invalid Input! Number is outside of acceptable range." Sample Runs (user input shown in green, with each run separated by a dashed line): -------------------------------------------------------------------------------SAMPLE RUN 1 Please enter a number 1-26: 17 You have entered 17 Character 17 of the alphabet is Q2 -------------------------------------------------------------------------------SAMPLE RUN 2 Please enter a number 1-26: 83 You have entered 83 Invalid Input! Number is outside of acceptable range.

Part 3: (Assessment) Logic Check Enter the following values by running Number.java after your modification and explain the behavior in a Word document or text file named Part3. 1 20 Lab 08: More Control Flow CSE-020-01 Points: 20 1000 500000000000 -500000000000 12,345 789.543 -0

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions