C++ Answers

Questions answered by Experts: 9 913

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

1.      Create a class polynomial to create a linked list that uses class node from task 1 with the following functionalities

a.      Insertion. This function takes as an input the size of polynomial. E.g if the size is 6, the polynomial equation is of degree 6. Then you are required to create the appropriate list.

6x6+ 12x3+5

b.      Deletion. This function deletes the list of the degree of number passed as a parameter. E.g if the number is 7, it is invalid. If it is 2, it deletes the first 2 degrees and the remaining list is 12x3+5

c.      Overload the function of deletion. This function deletes the entire list.

d.      Traversal

e.      Print equation in the following format

6x6+0x5+0x4+ 12x3+0x2+0x1+5


1.      Create a class Node with

a.      attributes data and next pointer

b.      accessors and mutators

c.      constructor and destructor

d.     function called display

e.      search node returning true or false

f.       overload the function search to include lookAhead method.

You are required to write a C++ program to assist Dr Plaatje with the running of her surgery. She

needs to know:

1) how many patients she has seen in the month.

2) the five (5) day in which she made most the money, (five highest earning days). If there are

more than one (1) days in which she made the same amount, just indicate that it was

duplicated on a particular day. Only note or record the last duplicate.

3) how much money she has collected in the month.

Also:

(a) Your program must run until the user stops it when the surgery closes at the end of the day,

when the report has to be generated.

(b) Assume a month has 31 days at most.

(c) Your program must ensure that input day is within the range [1..31]. It must not accept days

outside the range.


You are required to write a C++ program to assist Dr Plaatje with the running of her surgery. She needs to know: 1) how many patients she has seen in the month. 2) the five (5) day in which she made most the money, (five highest earning days). If there are more than one (1) days in which she made the same amount, just indicate that it was duplicated on a particular day. Only note or record the last duplicate. 3) how much money she has collected in the month. Also: (a) Your program must run until the user stops it when the surgery closes at the end of the day, when the report has to be generated. (b) Assume a month has 31 days at most. (c) Your program must ensure that input day is within the range [1..31]. It must not accept days outside the range.


#include<iostream>

#include<iomanip>

using namespace std;

char secretCode(int);

void printSequence(int);

int main(){

int number[10];

for (int index=0; index <10; index++){

cin >> number[index];

}

for (int index=0; index <10; index++){

cout <<secretCode( number[index]);

}

return 0;

}


char secretCode(int n){

char letters[] = "abcdefghijklmnopqrstuvwxyz";

int number=n;

while(number > 26){

number = number -26;

}

return letters[number-1];

}




Code above runs perfectly well,


  1. what is the output if the user input are the numbers 12, 23, 34, 45, 56, 67, 78, 89, 90, 101?
  2. what is the value of the secret code or character for index 6 if the input is the numbers 12, 23 34 ,45, 56, 67, 78, 89, 90, 101?
  3. what is the value of the secret code or character for index 2 if the input is the numbers 12, 23,34 ,45, 56, 67, 78, 89, 90, 101?
  4. what is the output if the user input are the numbers 1, 2, 3, 4, 5, 6, 7, 8, 9, 10?

Write a C++ program that reads the number of sales (as integer values) at the end of each month for the ABC Supermarket of 5 departments (grocery, bakery, meat, vegetables, and electronics). The program reads all data from the input file sales.txt. The first line has an integer value N that represents the number of months to be processed. The following N input lines contain the name of the month followed by the sales of each department in that month (5 integer values).

Your program shall produce a nice report in a file report.txt showing the list of months and the sum of 5 sales for that month. The program will also output the total sum of all sales and the average sales per month. Format your output to produce an exact result as in the sample below. To output the # use setw(3), to output the month name use setw(6) and use setw(12) to output the sum of sales for the month. The final output should be limited to 2 decimal places.


Write a base class Computer that contains data members of wordsize(in bits),



memorysize (in megabytes), storagesize (in megabytes) and speed (in megahertz).



Derive a Laptop class that is a kind of computer but also specifies the object’s length,



width, height, and weight. Member functions for both classes should include a default



constructor, a constructor to inialize all components and a function to display data



members.

Write a class Person that has attributes of id, name and address. It has a constructor to


initialize, a member function to input and a member function to display data members.


Create another class Student that inherits Person class. It has additional attributes of


rollnumber and marks. It also has member function to input and display its data


members.

Write a program having a base class Student with data members rollno, name and


Class define a member functions getdata() to input values and another function


putdata() to display all values. A class Test is derived from class Student with data


members T1marks, T2marks, T3marks, Sessional1, Sessional2, Assignment and Final.


Also make a function getmarks() to enter marks for all variables except Final and also


make a function putmarks() to display result. Make a function Finalresult() to


calculate value for final variable using other marks. Then display the student result


along with student data.

write a program executing a loop,which is readinginteger numbers from the keyboard until at least one of the below listed conditions is fulfilled

1.the multiplication of these numbers exceeds 1000

2.the number of reported even numbers exceeds 10

3.three subsequent numbers will have exactly the same value (eg 3,4,2,5,5,5)


LATEST TUTORIALS
APPROVED BY CLIENTS