Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Obiectives . Be able to construct boolean expressions to evaluate a given condition Be able to compare Strings . Be able to use a flag

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Obiectives . Be able to construct boolean expressions to evaluate a given condition Be able to compare Strings . Be able to use a flag . Be able to construct if and if-else-if statements to perform a specific task Be able to construct a switch statement . Be able to format numbers Introduction Up to this point, all the programs you have had a sequential control structure. This means that all statements are executed in order, one after another. Sometimes we need to let the computer make decisions, based on the data. A selection control structure allows the computer to select which statement to execute In order to have the computer make a decision, it needs to do a comparison. So we will work with writing boolean expressions. Boolean expressions use relational operators and logical operators to create a condition that can be evaluated as true or false. Once we have a condition, we can conditionally execute statements. This means that there are statements in the program that may or may not be executed, depending on the condition. We can also chain conditional statements together to allow the computer to choose from several courses of action. We will explore this using nested if-else statements as well as a switch statement. In this lab, we will be editing a pizza ordering program. It creates a Pizza object to the specifications that the user desires. It walks the user through ordering, giving the user choices, which the program then uses to decide how to make the pizza and how much the cost of the pizza will be. The user will also receive a $2.00 discount if his/her name is Mike or Diane. Obiectives . Be able to construct boolean expressions to evaluate a given condition Be able to compare Strings . Be able to use a flag . Be able to construct if and if-else-if statements to perform a specific task Be able to construct a switch statement . Be able to format numbers Introduction Up to this point, all the programs you have had a sequential control structure. This means that all statements are executed in order, one after another. Sometimes we need to let the computer make decisions, based on the data. A selection control structure allows the computer to select which statement to execute In order to have the computer make a decision, it needs to do a comparison. So we will work with writing boolean expressions. Boolean expressions use relational operators and logical operators to create a condition that can be evaluated as true or false. Once we have a condition, we can conditionally execute statements. This means that there are statements in the program that may or may not be executed, depending on the condition. We can also chain conditional statements together to allow the computer to choose from several courses of action. We will explore this using nested if-else statements as well as a switch statement. In this lab, we will be editing a pizza ordering program. It creates a Pizza object to the specifications that the user desires. It walks the user through ordering, giving the user choices, which the program then uses to decide how to make the pizza and how much the cost of the pizza will be. The user will also receive a $2.00 discount if his/her name is Mike or Diane

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

Database Development For Dummies

Authors: Allen G. Taylor

1st Edition

978-0764507526

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago