Question

In: Computer Science

You were introduced to control structures - such as IF-ELSE statement, WHILE and FOR loops. Describe...

You were introduced to control structures - such as IF-ELSE statement, WHILE and FOR loops. Describe what they do and why are control structures important to programming?

Solutions

Expert Solution

IF - ELSE statements are considered as the Control statements, Where these statements are used when we want check the given statement is considered to be true or any value, such that we can decide whether to execute the statement or not, if the given condition is false, then it will not execute the statement in the IF condition then the statement in the ELSE statement will Execute

WHILE and FOR Loops are used to iterate throgh something, it makes us there will be no repeated statements, since we will use the loops, we dont need to write each statement one by one, let the FOR and WHILE Loop statements will take care of itself instead of repeating the statements

Control structures are very important in the programming, where event to be execute or not to execute will depend on the statements we derive, and the loops are used to iterate over the arrays or strings or anything else, which makes them very important for the programming


Related Solutions

Objectives To reinforce the use of If-Else statements To learn how to use while loops Introduction:...
Objectives To reinforce the use of If-Else statements To learn how to use while loops Introduction: Mission to Mars Your friend has been playing a new Mars Colony simulator nonstop! They are always talking about how cool it would be if they could be a on the first real-life mission to Mars! To amuse your friend, you have decided to create a series of programs about the possible first colony on Mars. Problem: Where Can We Get the Best Deal?...
Module/Week 3 ASSIGNMENT (CONTROL STRUCTURES . IF ..ELSE) Write a C++ program that computes a student’s...
Module/Week 3 ASSIGNMENT (CONTROL STRUCTURES . IF ..ELSE) Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score...
Code in Python. You can only use while loops NOT for loops. Program 1: cost_living In...
Code in Python. You can only use while loops NOT for loops. Program 1: cost_living In 2020 the average cost of living/month (excluding housing) for a family of 4 in Pittsburgh was $3850 per month. Write a program to print the first year in which the cost of living/month is over $4450 given that it will rise at a rate of 2.1% per year. (Note:  this program requires no input). Program 2: discount A discount store is having a sale where...
Access control" - Several "Access control" best practices were introduced this week. What is the goal...
Access control" - Several "Access control" best practices were introduced this week. What is the goal of "Access control"? Which "Access control" best practices would you recommend be implemented in a company accounting department?
This assignment will acquaint you with the use of while loops and boolean expressions. You will...
This assignment will acquaint you with the use of while loops and boolean expressions. You will create a program that acts as a score keeper of a racquet ball game between two players. The program will continually ask the user who the winner of every point is as the game is played. It will maintain the scores and declare the match is over, using these rules: (1) A game is over when a. one of the players wins 7 points...
Topics Loops while Statement Description Write a program that computes the letter grades of students in...
Topics Loops while Statement Description Write a program that computes the letter grades of students in a class from knowing their scores in a test. A student test score varies from 0 to 100. For a student, the program first asks the student’s name and the student’s test score. Then, it displays the student name, the test score and the letter grade. It repeats this process for each student. The user indicates the end of student data by entering two...
Python Programming This assignment will give you practice with interactive programs, if/else statements, collections, loops and...
Python Programming This assignment will give you practice with interactive programs, if/else statements, collections, loops and functions. Problem Description A small car yard dealing in second hand cars needs an application to keep records of cars in stock. Details of each car shall include registration(rego), model, color, price paid for the car (i.e. purchase price) and selling price. Selling price is calculated as purchased price plus mark-up of 30%. For example, Toyota Corolla bought for $20,000 will have the selling...
Material covered: Loops Functions Data Structures Randomness Numpy arrays (python language) Problem statement A single amoeba...
Material covered: Loops Functions Data Structures Randomness Numpy arrays (python language) Problem statement A single amoeba sits in a pitri dish. Every 5 minutes one of two things will happen to the amoeba: 1.    There is a chance that the amoeba dies - producing no offspring. 2.    If it does not die the amoeba splits into two amoebas. make a function that simulates a single trial to calculate the lifespan of a colony of amoebas, given their chance of survival. Then, run...
When cell phones were first introduced, bandwidth was limited, which led to economically interesting pricing structures....
When cell phones were first introduced, bandwidth was limited, which led to economically interesting pricing structures. One by Spring offered 4,000 free minutes for $39.99 a month. The fine print revealed a catch. Only 350 of those minutes were anytime minutes; the remaining were restricted to evening and weekend usage. If you went over your allotted time, you were charged 35 cents per minute for any additional minutes. What was your marginal cost? Graph it. What would your average variable...
When cell phones were first introduced, bandwidth was limited, which led to economically interesting pricing structures....
When cell phones were first introduced, bandwidth was limited, which led to economically interesting pricing structures. One by Spring offered 4,000 free minutes for $39.99 a month. The fine print revealed a catch. Only 350 of those minutes were anytime minutes; the remaining were restricted to evening and weekend usage. If you went over your allotted time, you were charged 35 cents per minute for any additional minutes. a. What was your marginal cost? Graph it. b.What would your average...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT