Difference between a variable and a constant

Assignment Help C/C++ Programming
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

Reference no: EM132949720

Questions Cloud

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.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write functions that add a user to a server

Write functions that add a user to a server, disconnect a user from a server, balance the server load, etc - manage a list of computer servers

  Program in c to calculate gross salary

Ramesh basic salary is input through keyboard his da is 40% of basic salary and hra is 20% of basic salary. Draw a flow chart; write an algorithm and program in c to calculate gross salary.

  Write a program that implements a simple text editor

Write a program that implements a simple text editor. Use a J Text Area for the area that the user can enter text.

  Implement a discrete cosine transform described

Implement a discrete cosine transform described as follows. To facilitate your implementation, you need to use your assignment 1

  Information about different automobile parts

While entering the information about different automobile parts in the application, the database administrator enters the prices of some parts incorrectly. The prices are swapped between various parts.

  Different types of relationships that exist between tables

What are the different types of relationships that exist between tables?

  Create three diffrent arrays for numbers

Using a linked list to read in a paragraph from an input file. Put the words in alphabetical order. Words cannot be numbers, punctuation or symbols.

  Calculate final sales amount

I would appreciate if anyone can provide me answers for Q4 & 5 only. Kindly save in words document. Using Visual Basic 2005 (C++)

  Implementation of the class integer

Implementation of the class Integer, Implementation of the Array class The class will handle an array of objects of class Integer.

  Write a function that will take in an array of integers

Write a function that will take in an array of integers, sum up all the values in the array, and return the result to the calling function.

  Calculate the effective access time

Calculate the Effective Access time if page fault rate is 5% and 60% of time the page has to be replaced.

  Write programs to play a card game

You will write two programs to play a card game ("clubs"). A separate document describing the rules of "clubs" will be provided.The first program (clubber) will listen on its stdin for information about the game and give its moves to stdout.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd