Reference no: EM132949720
SIT102 Introduction to Programming
Task 1: Hello User
Overview
Now that we have variables, constants, and some basic of proper use of functions from week 2 pre- class resources and class, you should be able to create a program that use these to collect the user's inputs and store the corresponding data in memory with the desired data types. Get started by reading in the users name from the Terminal and echoes back a welcome message. Learn how to work with variables, constants, and functions. Later on, you will extend you knowledge and skills to create your own functions for some different calculations in Hello User 2.
Your Task
To build a program with the features with the given code. The relevant sections of the code are shown in the figure at the following page.
You are recommended to code the syntax by yourself as a practice or get the start up framework to build your program block by block - get the framework from Resource.zip at this OnTrack task. The framework provides you with definitions of read_string() and read_integer(), and a function definition prototype in code comments. Please be noted, the code comments in the given .cpp of resources aim to provide you with all details - it is a good example of "over commented" source code!
If you would like to get more details on function declaration and definition. You could study Unit Site's pre-class resource - Week 3 contents in advance! Week 2 and Week 3 are respectively part 1 and part 2 of topis in Data and Functions.
The functional goals of your program:
1. Ask the user to enter his/her name and age (provided in the figure)
• Output the details of the user's inputs (provided in the figure)
2. Ask the user to enter the bird name, frequency of the named bird in beating its wings, and amplitude of its stroke. Assume the user will only input a whole number for both frequency and amplitude.
• Output the bird name entered by the user and the resultant air speed
For details on airspeed calculation see The Shrouhal Number in Cruising Flight and Estimating theAirspeed Velocity of an Unladen Swallow.
This must demonstrate the creation and use of:
• Local variables for the name, age (provided in the figure)
• Local variables for the frequency of the named bird in beating its wings, amplitude of its stroke, and others as needed. //Hints: Think about the data types in their declarations
• Global constant for the Strouhal number (provided in the figure)
• Function calls for the following:
o To calculate the air speed velocity, with parameters for bird name, frequency and, amplitude from the user inputs, by calling
double calculate_air_speed(int freq, int amp)
Note: Assume the user will only input a whole number for both frequency and amplitude.
o To output the resultant air speed along with the bird name to the terminal.
void output_air_speed(string name, int freq, int amp)
o To read in a string from the user, with a parameter for the message to prompt them with.
string read_string(string prompt)
o To read in an integer from the user, with a parameter for the message to prompt them with.
string read_integer(string prompt)
Make sure to adjust all user inputs to use your read_string, and read_integer functions if applicable.
You may be asked for Discuss to demonstrate your understandings of the weekly topic:
• Explain the difference between a variable and a constant. When would you use each of these?
• Why use constants when the value could just be typed in the code everywhere it is needed?
• What are some of the different types you can use for the values in your variables?
Attachment:- Introduction to Programming.rar
Five generic competitive strategies and apple inc
: The Five Generic Competitive Strategies and Apple Inc. as an example company, describe how you would classify Apple's competitive strategy and why?
|
What is the percentage return loses
: After an analysis of Lion/Bear, Inc., If O'Grady does sell the stock short, what is the percentage return he loses if the price of the stock rises to $12?
|
Ethical standards of professional conduct
: Compare and contrast how our personal values relate to ethical standards of professional conduct. Healthcare setting.
|
Discuss the training theory and primary tenets
: Imagine that you work for a global automobile manufacturer as a lead training and development associate. The head of human resources (HR) has had meetings with
|
Difference between a variable and a constant
: Create a program that use these to collect the user's inputs and store the corresponding data in memory with the desired data types. Get started by reading
|
What the longer the time to maturity
: What the longer the time to maturity? the greater the bond price increase from an increase in interest rates./ the less the bond price increase from an increase
|
Pg marketing-middle-class adjustment
: Tide, Pampers, Bounty, Gillette, Crest, Scope, and Febreze. What do they all have in common? They are just a few of the brands owned by Procter & Gamble (P&G),
|
Cinnamon case-sales negotiation
: You are the owner of Mahek Masala Products Pvt. Ltd., a trading company that deals in the trading and processing of specialized spices from Kerala. Kerala is a
|
Calculate the employment insurance premium for pay period
: An Ontario employee has year-to-date Employment Insurance premiums of $878.72 in 2021. Calculate the Employment Insurance premium for the pay period.
|