程序代写代做代考 c++ SIT102 Introduction to Programming

SIT102 Introduction to Programming
Pass Task 2.1: Hello User Overview
Now that we have variables, constants, and functions we can create a programs that use these to perform interesting tasks. Get started by reading in the users name from the Terminal and echoes back a welcome message, along with some important calculations. Learn how to work with variables, constants, and functions.
Submission Details
Use the instructions on the following pages to create your own Hello User program. Submit the following files to OnTrack.
Answers to the supplied questions
A screen shot of your program running Your program code
The focus of this task is on:
Declaring and using local variables Declaring and using global constants Create and calling functions
Passing parameters
Declaring and using constants

Your Task
Follow the steps in the week 2 videos to build a program with the following features. The relevant sections of the code are shown after the instructions.
Ask the user to enter their name and age
Calculate and output the air speed velocity of the following birds:
African Swallow: frequency 15hz, amplitude 21cm
European Swallow: frequency 14hz, amplitude 22cm
Another bird, where the user enters the frequency and amplitude and name for the bird.
For details on this calculation see The Shrouhal Number in Cruising Flight and Estimating the Airspeed Velocity of an Unladen Swallow.
Then use what you learn to create your own function that calculates something based on values the user inputs.
This must demonstrate the creation and use of:
Local variables for the name, age, and others as needed. Global constant for the Strouhal number
Functions for the following:
A function of your own creation. For example, calculate an AFL score from points and goals, circle area given a radius, BMI given weight and height, or any other value where you can show the use of parameters and returning a value from a function.
Have the user input the necessary details, and then output the result of your calculation. To calculate the air speed velocity, with parameters for frequency and amplitude
double air_speed(int frequency, double amplitude)
To read in a string from the user, with a parameter for the message to prompt them with.
string read_string(string prompt)
Have a look at the How functions are used video for the instructions needed to read in a string (see how we do this to read in the user¡¯s name). Also watch the How functions are created video for how to code this function.
To read in an integer from the user, with a parameter for the message to prompt them with.
int read_integer(string prompt)
Have a look at the How functions are used video for the instructions needed to read in an integer (see how we do this to read in the user¡¯s age). Follow the same steps used to create the read string function in How functions are created video to create the read integer function.
To read in a double value from the user, with a parameter for the message to prompt them with.

double read_double(string prompt)
This will be very similar to read integer, in this case you can convert_to_double rather then converting to an integer.
Make sure to adjust all user input to use your new read_string, read_double, and read_integer functions.

Reminders
Use the following instructions for setting up your project in the terminal.
cd /c/Users/andrew/Documents/Code mkdir HelloUser
cd HelloUser
skm new c++
Open Visual Studio Code and open the folder you created.
Remember to make sure to open the folder (directory) not just the file. This will let VS Code find
all of the files related to your project, including the SplashKit files. Compile and run the program using the following instructions:
skm clang++ program.cpp -o HelloUser ./HelloUser
Splashkit includes a number of functions that can help:
Function
Task
void write(string message);
Writes a message to the terminal, and stay on the same line.
void write_line(string message);
Writes a message to the terminal, and goes to the next line.
string read_line();
Reads a line of text from the user and returns it.
int convert_to_integer(string text);
Convert the text into an integer, and return the value read.
double convert_to_double(string text);
Convert the text into a double, and return the value read.

Figure: Code from the videos for the program

Step 3: Submit your work
Do the following before you submit:
Check to make sure you have the following:
Functions to read user input: read_string, read_integer, and read_double. A function to calculate air speed.
Calls to test different bird values
Your own function to calculate some value
Download the task resources, and answer the questions in the Word file. Save as PDF to prepare for upload.
Run your program and grab a screenshot of your scene.
When you are ready, login to OnTrack and submit your code, screenshot, and answers to Pass Task 2.1.
Remember to save and backup your work! Storing your work in multiple locations will help ensure that you do not lose anything if one of your computers fails, or you lose a USB Key.
Task Discussion
After your submission, your tutor will mark your submission and give you feedback in 3-4 business days. Your tutor may further ask you some questions on the weekly topics and/or about your submissions. You are required to address tutor’s questions as a form of task discussions. Please frequently (at least in 3-4 days) login to OnTrack for the task discussion or fix your work (if needed) based on tutor’s feedback to get your task signed off as complete.
You will further discuss the following with your tutor to demonstrate your understanding of the concepts covered.
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?