Get fast, custom help from our academic experts, any time of day.
Place your order now for a similar assignment and have exceptional work written by our team of experts.
Secure Original On Schedule
NO AI
NO PLAGIARISM
NO REFERENCES
NO CHAT GPT
Minimum 50 words per response:(What are your thoughts)
1) Branching, also refer to as conditional branching, is a type of flow control statements in software development which is used for decision making. That is, it provides programming a construct to conditionally change the flow of execution in a block of code.
Our lesson this week showed us how to use if statement, if-else statement, and if-elseif statement to dictate which code should be executed. Later in our software development pursue, you will encounter additional conditional branching construct available in different programming languages that can add to your tool. For example, Java and C# languages provide switch case statement enables us to select which one of a multiple block of codes to execute by matching pattern of an expression:
Switch (expression)
{
Case expression_value1:
Statement 1
Break;
Case expression_value2:
Statement 2
Break;
Case expression_value3:
Statement 3
Break;
Default:
2) When constructing this discount for twenty percent to people who are sixty-five years or older it is important to understand the branching construct. Being able to acknowledge that this is a code that will need to distinguish between someone who is sixty-five and below. If I was to write this code I would start by stating the hotel rate. After I have written the hotel rate I would include a transaction to ask for the users age. Once the user has input their age I would write the transaction to allow someone who is over the sixty-five year age requirement to get the twenty percent discount. If they are not sixty-five years of age the code would would output the regular hotel rate, however if the user is over sixty-five the output would add in the discount then give the hotel rate. The code that would need to be written would need to look something like this:
HotelRate = 180
UserAge = Get next input
UserAge > 65
(True) HotelRate – 20
(False) HotelRate
(True) Put “Your rate: ” to output
(False) Put HotelRate to output
Get fast, custom help from our academic experts, any time of day.
Secure Original On Schedule