Write a C++ program that will allow the teachers to do the following:
4.1 Capture the student performance record in a sentinel-controlled loop and store the results in three parallel arrays. The information to be stored in the three arrays is the student’s full name, continuous assessment mark, and final mark. If the lecturer types the word ‘Done’ instead of a full name, the loop should immediately stop even before capturing any marks.
(6 Marks)
4.2 Search the array for the student’s full name and then display the full record of the student, or the notification that student does not exist. You should also allow the teachers to search for the best or worst performer in the Final Mark column. When the mark is found, let it be displayed with all the student’s details. (8 Marks)
4.3 Make this program a menu driven system with the following options: Capture Marks, Find a Student, Find the Best Performer, Find the Worst Performer,
#include <iostream> #include <vector>
std::vector<std::string> getUniqueBrands(const std::vector<std::string>& brand1, const std::vector<std::string & brand2)
{
throw std::logic_error("yet to be implemented");
}
int main()
{
std::vector<std::string> brand1 = {"LOUIS VUITTON", "HERMES", "PRADA"};
std::vector<std::string> brand2 = ("GUCCI", "PRADA", "HERMES"};
std::vector<std::string> result = getUniqueBrands(brand1, brand2);
for(auto element: result)
{
std::cout << element << '
// should print GUCCI HERMES LOUIS_VUITTON PRADA
}
}
Encapsulation
Create a class for a point (that has an x-coordinate and a y-coordinate). Also, create another class called Rectangle. The Rectangle should have 2 points, the top left and the bottom right. You should also implement the following methods for the Rectangle:
display() - draws the rectangle on the console based on the sample
area() - computes and returns the area of a given rectangle
perimeter() - computes and returns the perimeter of a given rectangle
centerPoint() - computes and returns the center point of a given rectangle
isSquare() - checks whether a given rectangle is a square or not.
Input
A pair of numbers representing the points for the rectangle (x and y).
5 8
Output
The first few lines contain the drawn rectangle. After one empty line, the next line prints either "RECTANGLE" or "SQUARE". This is then followed by its area, perimeter, and the coordinates of its center point.
RECTANGLE
AREA:·40
PERIMETER:·26
CENTER·POINT:·(2.50,4.00)
5.1 Use the provision for Rrecords in C++ to create each employee’s record. The record should have the following fields: Name, Surname, Gender, Qualification (Education Level), Position, NoOfChildren, and Salary. All these must be captured by one cin statement, the values separated by spaces, which means that each field value should not have spaces.
(4 Marks)
5.2 Every record captured must be written into a file that is open for output while information is being captured from the keyboard. Each record must use a space as the field delimiter. Therefore, each record is saved on one line on the text file. Make sure the file is only closed just before it is opened for read. Keep it open until all records have been captured. (4 Marks).
5.4 The system should be a menu driven system with the options: Capture Employee, Print Payslips and Exit. When the Capture Employee menu is chosen, the user is asked how many employees they want to capture.
Please correct the errors in each problem. There are syntax errors, logical errors and runtime errors
1
x = 'hello'
y = ['hello']
if x == y(0):
print('Equal')2
x = 'hello'
y = ['hello']
z = x + y
z.sort()3
x = 'hello'
y = ['hello', 'goodbye']
print(x+y)4
x = 'hello'
y = ['hello', 'goodbye']
print(x+y[1])6.
def myfunction(x, y):
return x + y
myfunction(1)7.
def myfunction(x, y):
return x + y
myfunction(x=1, 5)8.
myList = [1, 5, 10]
print(myList[3])9.
myList = list(range(0,10))
print(myList[0] + myList[10])10.
myList = list(range(0,10))
for x in myList:
print(myList[x]/myList[x-1])11.
for x list(range(0,10)):
print(x)12.
def recurseMe(x, y):
return recurseMe(x-1 * y -1, x)
def main():
print(recurseMe(1,2))
main()I would really appreciate your help!
consider an array MARKS [20] [5] which stores the marks obtained by 20 students in 5 subjects. now write a program.
(a.) find the average marks obtained in each subject.
(b.)find the average marks obtained by every student
(c.) find the number of students who have scored below 50 in their average.
(d.) display the scores obtained by every student.
Given the following host requirements and using the IP address 195. 20. 5.0/18 divide the network using VLSM. 550, 30, 1050, 880, 58, 2, 2, 2
Encapsulation
Construct a class called Term. It is going to represent a term in polynomial expression. It has an integer coefficient and an exponent. In this case, there is only 1 independent variable that is 'x'.
There should be two operations for the Term:
public Term times(Term t) - multiplies the term with another term and returns the result
public String toString() - prints the coefficient followed by "x^" and appended by the exponent. But with the following additional rules:
if the coefficient is 1, then it is not printed.
if the exponent is 1, then it is not printed ( the caret is not printed as well)
if the exponent is 0, then only the coefficient is printed.
Input
The first line contains the coefficient and the exponent of the first term. The second line contains the coefficient and the exponent of the second term.
1·1
4·3
Output
Display the resulting product for each of the test case.
4x^4
Write a program that accepts grade as input from the user and stores these grades in twodimensional array with dimension of 5 rows and by 5 columns. Then count the number of grades that
passed and the number of grades that failed. Grade that pass must be greater or to equal to 80.
Enter the grades: 90 95 78 89 88 71 72 79 81 82 77 74 78 88 91 73 77 75 84 98 76 89 71 87 73 79
There are 12 that passed.
There are 13 that failed.
Make a program code reverse the display from N to 1 to 1-N