C++ language
https://drive.google.com/file/d/1K4ZxYGUuwie1pTjs9LD3v7IsSF4WUpSl/view?usp=sharing
If you want the 2nd book for free here is the 3rd edition. Click on “GET” and it will redirect you and download within your browser.
http://library.lol/main/F1607751C1B3074B393D6B5BCE0C11A0
CSCI110
– Fundamentals of Computer Science
Homework Assignments
Winter 2022
Instructions for your lab report.
1.
You need to create a cover page formatted as following:
(
Notes:
The cover page needs to be typed and printed)
CSCI110 – Fundamentals of Computer Science
MT SAC College
CSCI110
Lab #: __________________
Description: ______________________
______________________
______________________
Due Date: ___________________
Name: _______________________
Grade: _______________________
Notes: ______________________
CSCI110 – Fundamentals of Computer Science
Requirements for your lab reports
Your submission should include:
1. The cover page
2. The listing of the source code (See details shown below)
3. A screenshot of your program execution
The source code should be organized and presented as:
1. Prolog
a. Program Description
b. Author
c. Input variables
d. Process Flow
e. Output variables
2. A listing of source code with internal comments
Programming requirements:
1. Your program needs to be user-friendly and easy to understand.
2. You need to follow the book’s and my instructions to code your program – no deviation. If you have any questions, please let me know.
CSCI110 – Fundamentals of Computer Science
Homework Assignments
Winter 2022
Lab 1A
Requirements:
Please work on p1.6 on page 26.
Test cases:
1. Please produce the report based on the book’s instructions.
1. Initial principal = 10000 (Please prompt the user for this amount)
1. Print ‘”New balance = “ for 3 years.
Due date: January 11, 2022
Submission includes
1) cover page 2) source listing 3) screen shot of program execution.
CSCI110 – Fundamentals of Computer Science
Lab 1B
Requirements:
Please work on p2.21 on page 69. You need to work on both conditions – the first time is earlier than the second time and the first time is later than the second time. There is no extra credit given for this lab.
Test cases:
1. You need to test both conditions mentioned in the requirements.
1. You need to print a user-friendly message showing the difference between these two times. Do not follow the book by simply printing “8 hours and 30 minutes”.
1. Don’t use your own data to test your program.
Due date: January 11, 2022
Submission includes 1) cover page 2) source listing 3) screen shot of program execution.
CSCI110 – Fundamentals of Computer Science
Lab 2A
Requirements: Please work on p3.9 on page 119. Also, show at least 9 test cases (i.e., A, A-, B+, C-, D+, D-, F, etc.)
Test cases: You need to test at least 9 cases out of all possible grades (A+, A, A-, B+, B, B-, C+, C, C-, D+, D, D-, F, F+, F-). Also, you need to test A+, F+, and F- (See Notes for more information.)
Due date: TBD
Submission includes 1) cover page 2) source listing 3) Screen shot of program execution.
Notes:
A+ = 4
F+ = 0
F- = 0
CSCI110 – Fundamentals of Computer Science
Lab 2B
Hi guys,
The first option – Please work on p4.14 on Page 182
Test cases:
1. Your program needs to prompt the user for an input string values (i.e., Harry, hairy, hare, and the).
2. Your program should produce a report with a header (i.e., Word for the first column, and Syllabus for the second column) for each column.
3. Your report should look like the following
Word Syllabus
Harry 2
hairy
2
hare 1
the 1
Due date: January 24, 2022
Submission includes 1) cover page 2) source listing 3) Screen shot of program execution.
Thanks!
CSCI110 – Fundamentals of Computer Science
Lab 3A
Requirements:
Please work on P
5
.11 on page 238. Your program should prompt the user for 2 values (radius and height). When you test your program, please assign 4 to the variable r (for example, r = 4.0) and assign 8 to the variable h (for example, h = 8.0) so that you and me both can check your program and figure out whether your program produces the right answer.
Output – Your program should generate a table with a table header as following:
Volume Surface
Sphere
Cylinder
Cone
Final Note:
1) Do not deviate from the requirements stated here, and
2) The output values should show 2 decimal places. Please use a format statement such as setprecision(2) to implement this requirement.
Test Cases:
Please use the following test cases to test your program.
Case 1:
Radius: -4 (Your program should generate an error message and stop processing)
Next, prompt the user for continuation. Example, send a message as “Do you want to continue (y/n)?”
Case 2:
Height: -8 (Your program should generate an error message and stop processing)
Next, prompt the user for continuation. Example, send a message as “Do you want to continue (y/n)?”
Case 3: Radius: 4
Height: 8
Message: “Do you want to continue (y/n)?”
Case 4: n
send a message: “Exit!”
Due date: January 31, 2022
Submission includes
1) The cover page
2) The source listing
3) A screen shot of program execution.
Thanks!
CSCI110 – Fundamentals of Computer Science
Lab 3B
Requirements:
Please work on P5.13 on page 239. If the input value is invalid, prompt the user to re-enter.
Output – your program should print the (new salary) based on the total amount of the raise and original salary.
Test Cases:
Please use the following test cases to test your program.
Case 1:
Salary: -$50,000 (Your program should generate an error message and stop processing)
Percentage raise: 20% (.20)
Message: “Do you want to continue (y/n)?”
Case 2:
Salary: $50,000
Percentage raise: – 20% (-.20) (Your program should generate an error message and stop processing)
Message: “Do you want to continue (y/n)?”
Case 3: Salary: $50,000
Percentage raise: 20% (.20)
Message: “Do you want to continue (y/n)?”
Case 4: n
send a message: “Exit!”
Due date: January 31, 2022
Submission includes
1) The cover page
2) The source listing
3) A screen shot of program execution.
Thanks!
CSCI110 – Fundamentals of Computer Science
Lab 4A
Hi guys,
Please work on P6.9 on page 296
Requirements:
1. Please prompt the user for two arrays that are identical, and your program produces the message claiming,
“Both arrays are the same”
. Please print each element of these two arrays first and a message follows.
1. Please prompt the user for two arrays that are different, and your program produces the message claiming,
“Two arrays are different”
. Please print each element of these two arrays first and a message follows.
1. Each array should contain at least 10 elements. Both arrays can have a capacity of 20 elements. So, you should declare A[20] and B[20] to implement this exercise. Your program does not know how many elements are contained in each array. Therefore, each array should have a current_size to assist in processing the array.
1. Your program should include the following function:
Bool equals(int a[], int a_size, int b[], int b_size)
Based on the return value, a propriate message should be generated.
Test cases:
Please test your program based on the following 4 cases.
1. Array A =
{
1,4, 9, 16, 9, 7, 4, 9, 7
}
Array B = {1,4, 9, 16, 9, 7, 4, 9, 7}
Messages:
Size of Array A = 9
Size of Array B = 9
“Both arrays are the same”
1. Array A = {1,4, 9, 16, 9, 7, 4, 9, 7}
Array B = {1,4, 9, 16, 9, 7, 4, 9, 7, 8}
Messages:
Size of Array A = 9
Size of Array B = 10
“Two arrays are different”
1. Array A = {1,4, 9, 16, 9, 7, 4, 9, 7}
Array B = {7,9, 4, 7, 9, 16, 9, 4, 1}
Messages:
Size of Array A = 9
Size of Array B = 9
“Two arrays are different”
1. Array A = {1,4, 9, 16, 9, 7, 4, 9, 7, 8}
Array B = {1,4, 9, 16, 9, 7, 4, 9, 7}
Messages:
Size of Array A = 10
Size of Array B = 9
“Two arrays are different”
Due date: February 3, 2022
Submission includes
1) The cover page
2) The source listing
3) A screen shot of program execution.
Thanks!
CSCI110 – Fundamentals of Computer Science
Lab 4B
Hi guys,
Please work on P6.12 on page 297
Requirements:
1. Please use the sequence numbers as indicated in your book as input values
1 4 9 16 9 7 4 9 11
to fill out an array.
Note: Please print the input stream
1. Your array should look like
1 4 9 16 7 11
after all duplicates got removed.
Also, your program should print a user-friendly message to tell the reader a new array is from the original array without duplicates.
Note: Please print the members of your final array
1. You should use a function to remove duplicated members. As indicated by your book, you need to pass the array size to a called program.
Two Test Cases:
Case1: 1 4 9 16 9 7 4 9 11
Case2: 2 3 1 2 3 1 2 3 1
Due date: February 3, 2022
Submission includes
1) The cover page
2) The source listing
3) A screen shot of program execution.
Thanks!
CSCI110 – Fundamentals of Computer Science
Lab 5A
Hi guys,
Please finish P7.5 on page 344.
Requirements:
1. Please use the following sequence of numbers
1.3 4 5.2 16.3 9.99 7.21 4.5 7.43 11.21 12.5
to fill out an array.
Note: Please prompt the user for the input values and echo (print) them. Do not prompt the user for the size of the array. Your program should figure out the size of the array.
1. You need to code the following function
void reverse(double* a, int size)
After a function call, your program should print a new sequence of numbers (the reverse order of the original sequence of numbers). You need to code your own reverse function and cannot use the reverse function provided by the library (algorithm).
1. Please use two pointer variables as indicated in the program statement to code this program. Otherwise, no points will be given.
Due date: February 7, 2022
Submission includes
1) The cover page
2) The source listing
3) A screen shot of program execution.
Thanks!
CSCI110 – Fundamentals of Computer Science
Lab 5B
Hi guys,
Please finish P7.10 on page 344.
Requirements:
1. Your program should prompt the user for the following sequence of numbers
1.3 4 5.2 16.3 9.99 7.21 4.5 7.43 11.21 12.5
to fill out an array of size 10.
Note: Please echo (print) the input stream. Do not prompt the user for the size of the array. Your program can and should declare the size of the array is 10 initially.
2. Then, prompt the user for another 6 numbers as following
0. 4.5 9.5 16.5 7.5 11.5
You need to create a new array of size 20 to contain all 16 numbers.
Note: Please print all 16 members of your new array.
1. You should use the Dynamic Memory Allocation (DMA) technique to implement this exercise (See section 7.4 for more information).
Due date: February 7, 2022
Submission includes
1) The cover page
2) The source listing
3) A screen shot of program execution.
Thanks!
CSCI110 – Fundamentals of Computer Science
Lab 6A
Hi guys,
Please work on the program (ch08/babynames.cpp on page 356) shown below.
//
====================================================
// Lab7A.cpp : Defines the entry point for the console application.
//
#include
#include
#include
using namespace std;
/**
Reads name information, prints the name if total >= 0, and adjusts the total.
@param in_file the input stream
@param total the total percentage that should still be processed
*/
void process_name(ifstream& in_file, double& total)
{
string name;
int count;
double percent;
in_file >> name >> count >> percent;
if (in_file.fail())
{
return;
}
// Check for failure after each input
if (total > 0)
{
cout << name << " ";
}
total = total – percent;
}
int main()
{
ifstream in_file;
in_file.open(“babynames.txt”);
if (in_file.fail())
{
return 0;
} // Check for failure after opening
double boy_total = 50;
double girl_total = 50;
while (boy_total > 0 || girl_total > 0)
{
int rank;
in_file >> rank;
if (in_file.fail())
{
return 0;
}
cout << rank << " ";
process_name(in_file, boy_total);
process_name(in_file, girl_total);
cout << endl;
}
return 0;
}
//==================================================
Requirements:
1. Please use the file (“babynames.txt) that will be provided to you to test your program.
1. You need to debug the program so that you can remove all bugs and get the program work without any bugs.
1. (Output 1) A console message to display only how many records have been processed. You need to attach the console message as part of your submission.
1.
(Output 2) You need to add codes to create an output file (“output.txt”) and write output streams to the file (not write to the console). You need to attach the file “output.txt” as part of your submission. Don’t send the output data to the console screen.
Due date: February 10, 2022
Submission includes
1) The cover page
2) The source listing
3) A screen shot of program execution and a printout of the file of “output.txt” .
Thanks!
CSCI110 – Fundamentals of Computer Science
Lab 6B
Hi guys,
Please work on P8.4 on page 380.
Requirements:
1. Your program should create a file containing 10 sets of a pair of two floating numbers.
·
Your program should prompt the user for the output file name.
·
Your program should use a random number generator to generate 10 numbers for the first component of the pair. Then, use a random number generator to generate 10 numbers for the second component of the pair. Each number should be greater than or equal to 10 and Less than or equal to 20. (i.e., [10 <= x < =20])
1. (Output 1) – Your program should display the content of the file. This can be done via a console display.
1. (Output 2) – Your program should produce a report (i.e., a docx file) showing a table containing 2 columns and an average of each column. Attach your report as part of the submission. By the way, each column should have a header.
Due date: February 10, 2022
Submission includes
1) The cover page
2) The source listing
3) A screen shot of program execution and printout of the table.
This is it, folks! Thanks!
5
CSCI110
– Fundamentals of Computer Science
Lab Assignments
Winter 2022
Instructions for your lab report.
1. You need to create a cover page formatted as following:
(Notes: The cover page needs to be typed and printed)
CSCI110 – Fundamentals of Computer Science
MT SAC College
CSCI110
Lab #: __________________
Description: ______________________
______________________
______________________
Due Date: ___________________
Name: _______________________
Grade: _______________________
Notes: ______________________
CSCI110 – Fundamentals of Computer Science
Requirements for your lab reports
Your submission should include:
1. A cover page
2. The listing of the source code (See details shown below)
3. A screenshot of your program execution
The source code should be organized and presented as:
1. Prolog
a. Program Description
b. Author
c. Date and time
d. Input variables
e. Process Flow
f. Output variables
2. A listing of source code with internal comments
Programming requirements:
1. Your program needs to be user-friendly and easy to understand.
2. You need to follow the book’s and/or my instructions to code your program – no deviation. If you have any questions, please let me know.