Usuing Visual Studio, I need help with these Labs. Would appreciate the most ans
ID: 3667725 • Letter: U
Question
Usuing Visual Studio, I need help with these Labs. Would appreciate the most answers possible. Trying to learn asap. Thanks.
Lab 1:
1. Open the source code file named CollegeAdmission.cpp using Notepad or the text editor of your choice.
2. Declare two integer variables named testScore and classRank.
3. Write the interactive input statements to retrieve a student’s test score and class rank from the user of the program. Do not forget to prompt the user for the test score and class rank.
4. The rest of the program is written for you. Save this source code file in a directory of your choice, and then make that directory your working directory.
5. Compile the source code file CollegeAdmission.cpp.
Here is the "CollegeAdmission.cpp" file info:
Lab 2:
Open the source code file named BadDate.cpp using Notepad or the text editor of your choice.
Notice that variables have been declared for you.
Write the simulated housekeeping() function that contains the prompts and input statements to retrieve a year, a month, and a day from the user.
Include the output statements in the simulated endOfJob() function. The format of the output is as follows:
month/day/year is a valid date.
or
month/day/year is an invalid date.
Here is the "Baddate.cpp" file info:
Lab 3:
In this lab, you complete a prewritten C++ program for a carpenter who creates personalized house signs. The program is supposed to compute the price of any sign a customer orders, based on the following facts:
- The charge for all signs is a minimum of $35.00.
- The first five letters or numbers are included in the minimum charge; there is a $4 charge for each additional character.
- If the sign is made of oak, add $20.00. No charge is added for pine.
- Black or white characters are included in the minimum charge; there is an additional $15 charge for gold-leaf lettering.
1. Open the file named HouseSign.cpp using Notepad or the text editor of your choice.
2. You need to declare variables for the following, and initialize them where specified:
- A variable for the cost of the sign initialized to 0.00.
- A variable for the color of the characters initialized to "gold".
- A variable for the wood type initialized with the value "oak".
- A variable for the number of characters initialized with the value 8.
3. Write the rest of the program using assignment statements and if statements as appropriate. The output statements are written for you.
4. Compile the program.
5. Execute the program. Your output should be: The charge for this sign is $82.
Here is the "House sign.cpp" file info.
Lab 4:
1. Open the file named LargeSmall.cpp using Notepad or the text editor of your choice.
2. Two variables named largest and smallest are declared for you. Use these variables to store the largest and smallest of the three integer values. You must decide what other variables you will need and initialize them if appropriate.
3. Write the rest of the program using assignment statements, if statements, or if else statements as appropriate. There are comments in the code that tell you where you should write your statements. The output statements are written for you.
4. Compile the program.
5. Execute the program. Your output should be:
The largest value is 78
The smallest value is -50
Here is the "Large Small.cpp" file info:
Explanation / Answer
CollegeAdmission.cpp
/* Program Name: CollegeAdmission.cpp
Function: This program determines if a student will be admitted or rejected.
Input: Interactive
Output: Accept or Reject
*/
#include <iostream>
using namespace std;
int main()
{
// Declare variables
int testScore=0;
int classRank=0;
// Prompt for and get user input
cout<<"Enter the test score"<<endl;
cin>>testScore;
cout<<"Enter the class rank"<<endl;
cin>>classRank;
// Test using admission requirements and print Accept or Reject
if(testScore >= 90)
{
if(classRank >= 25)
{
cout << "Accept" << endl;
}
else
cout << "Reject" << endl;
}
else
{
if(testScore >= 80)
{
if(classRank >= 50)
cout << "Accept" << endl;
else
cout << "Reject" << endl;
}
else
{
if(testScore >= 70)
{
if(classRank >=75)
cout << "Accept" << endl;
else
cout << "Reject" << endl;
}
else
cout << "Reject" << endl;
}
}
} //End of main() function
BadDate.cpp
/* Program Name: BadDate.cpp
Function: This program determines if a date entered by the user is valid.
Input: Interactive
Output: Valid date is printed or user is alerted that an invalid date was entered
*/
#include <iostream>
bool validateDate(int, int, int);
using namespace std;
int main()
{
// Declare variables
int year;
int month;
int day;
const int MIN_YEAR = 0, MIN_MONTH = 1, MAX_MONTH = 12, MIN_DAY = 1, MAX_DAY = 31;
bool validDate = true;
// This is the work of the housekeeping() method
// Get the year, then the month, then the day
cout<<"Enter the year"<<endl;
cin>>year;
cout<<"Enter the month"<<endl;
cin>>month;
cout<<"Enter the day"<<endl;
cin>>day;
// This is the work of the detailLoop() method
// Check to be sure date is valid
if(year <= MIN_YEAR) // invalid year
validDate = false;
else if (month < MIN_MONTH || month > MAX_MONTH) // invalid month
validDate = false;
else if (day < MIN_DAY || day > MAX_DAY) // invalid day
validDate = false;
// This is the work of the endOfJob() method
// test to see if date is valid and output date and whether it is valid or not
if(validDate == true)
{
cout<<month<<"/"<<day<<"/"<<year<<" is a valid date"<<endl;
}
else
{
cout<<month<<"/"<<day<<"/"<<year<<" is a invalid date"<<endl;
}
} // end of main() function
HouseSign.cpp
//HouseSign.cpp - This program calculates prices for custom made signs.
#include <iostream>
#include <string>
using namespace std;
int main()
{
// This is the work done in the housekeeping() function
// Declare and initialize variables here
// Charge for this sign
// Color of characters in sign
// Number of characters in sign
// Type of wood
int charge=0;
string color="gold";
int numCharacters=8;
string typeOfWood="oak";
// This is the work done in the detailLoop() function
// Write assignment and if statements here
if(numCharacters<=5)
{
charge+=35;
}
else
{
charge+=35+(numCharacters-5)*4;
}
if(color=="gold")
{
charge+=15;
}
if(typeOfWood=="oak")
{
charge+=20;
}
// This is the work done in the endOfJob() function
// Output charge for this sign
cout << "The charge for this sign is $" << charge << endl;
return(0);
}
LargeSmall.cpp
// LargeSmall.cpp - This program calculates the largest and smallest of three integer values.
#include <iostream>
using namespace std;
int main()
{
// This is the work done in the housekeeping() function
// Declare and initialize variables here
int first=4;
int second=8;
int third=2;
int largest=first; // Largest of the three values
int smallest=first; // Smallest of the three values
// This is the work done in the detailLoop() function
// Write assignment, if, or if else statements here as appropriate
if (second > largest)
largest=second;
if (third > largest)
largest = third;
if (second < smallest)
smallest = second;
if (third < smallest)
smallest = third;
// This is the work done in the endOfJob() function
// Output largest and smallest number.
cout << "The largest value is " << largest << endl;
cout << "The smallest value is " << smallest << endl;
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.