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

Write code that puts "less than -9\n" to output if the value of userNum is less than -9.

Ex: If userNum is -15, then output is:

less than -9
userNum: -15
ticket selling booth in a cricket stadium, people has to buy the ticket from
this booth to enter into the stadium. Price of the each ticket is Rs. 500. The
booth keeps track of the number of people visited the stadium. Model this
ticketing booth with a class called Counter A including following members
Data members
(i) Number of people visited
(ii) Total amount money collected
Member functions
(i) To assign initial value
(ii) To increment people total as well as amount total if a ticket is sold
out.
(iii) To display two totals
Write a program to test this class.

A college offers diploma course with five set modules each. Define a class Student as an ADT that uses separate files for the interface and the implementation. This class represents a record of one student’s registration and results. For each Student the following information should be kept as member variables:

the student’s name, ID, student number, the name of the diploma, average mark, an array with the five module codes for the diploma, and another array with five results - one for each of the modules.

Class Student should also have a member function calcAverage() to calculate the average for the five results and a member function pass() to determine whether or not a student has passed the module. A student only passes a diploma course if he or she has obtained more than 50% for all the modules, regardless of his or her average mark. Member function pass()should return a boolean value.

.


Create a class called bMoney. It should store money amounts as long doubles. Use the function ms_to_ld() to convert a money string entered as input into a long double, and the function ld_to_ms() to convert the long double to a money string for display. You can call the input and output member functions getmoney() and putmoney().

Overload the operators +,-,*,/ appropriately.


create a class Matrix the stores it in a safe 2D array .that is it it should check for array index bounds .a constructor should allow the programmer to specify the actual dimensions of the matrix. define number functions : putel() for taking 3 argument row index , column index and the element storing it in the corresponding location. getel() for taking 2 arguments row and column indexes and returns the elements from that location . overload the operators +,-,and * appropriately


Provide a member function of class linkedListType that determines the maximum element in a list. Use the following header template Type linkedListType:: max(); You may assume that operator> is overloaded for Type.  


Create the class Employee with the following attributes: EmpID, Name, Designation and Experience (in terms of number of years). Add a function Show() to print all details. Add a

pure virtual function SetDesignation() which should be defined in sub classes. Derive two

classes Technical Employee and Non TechnicalEmployee from Employee and override the

Set Designation() method appropriately based on the following conditions. Add necessary

constructors in base and derived classes to initialize all the data members except

Designation.

TechnicalEmployee SetDesignation method needs to be overridden based on Experience as follows

Experience Designation <6 Software Engineer

6 and <8 Senior Software Engineer

8 and 12 Project Lead

>12 Project Manager



the following through the main() function.

1) Create an array of pointers (emp) to Employee class with size 4 Store 2 numbers of technical employees and store 2 numbers of nontechnicalemployee.and print designation and details.

struct Module {string moduleName; string moduleCode; string lecturer; int nrStudents} Turn the Module struct into a class. The class should have member variables for all the values in the corresponding struct. Make all the member variables private. Include public member functions for each of the following: a default constructor that sets the string member variables to blank strings, and the int member variable to 0; an overloaded constructor that sets the member variables to specified values; member functions to set each of the member variables to a value given as an argument to the function; member functions to retrieve the data from each of the member variables; Test the class in a program that instantiates an object of class Module. The program should then input values for the object, and use the mutators to assign values to the member variables. Use the accessors to obtain the values of the object's member variables and display those values on the screen.


  1. Write a complete C++ code that has a structure like the following structure example:

struct student

{

       char IDNumber[10];

       char Name[20];

       int Age;

       char Department[25];

       float CGPA;

 } ;

Choose your structure name. Include five member variables for your structure. Then do the following questions based on your structure declaration.

a)    Define a function that declares array of student and registers 10 students.

b)    Define a function that displays full information about those 10 students.

c)    Define a function that can be used to update information about the first student.

 

 

 


1.Write C++ program to accept N number from the user and print the elements of the array in reverse order using a pointer.
2.Write C++ program that accepts N elements from the user and display the sum of array elements using pointers.
LATEST TUTORIALS
APPROVED BY CLIENTS