Create a list which contains the first three odd positive integers and a listbwhich contains the first three even positive integers.a= [1, 3, 5]b= [2, 4, 6]Create a new listcwhich combines the numbers from both lists (orderis unimportant).Find the Maximumvalue in list c (Donot use built-in function)Insert fourth element in listc42Append7,8and9to the end ofc.Print the first twoelements ofc.Print the last element ofbwithout using its length.Print the lengthofa
Write a program that reads a word and prints all sub strings sorted by length. For example, if the user enters the word ”cat”, the program prints
c
a
t
ca
at
cat
Use the notepad program to create a payroll file for 20 records as follow: Employee’s First name, Last
name, Social Security Number, Hours worked and Hourly rate.
Save this file and place it in the folder where your .CPP file is located in your program.
Write a C++ program to read this file into your program and do the proper calculation including overtime
if any. Overtime is times and half of the pay rate. Deduct 2% for Social Security, 5% retirement plan, 3%
Federal tax
(total of 10% deduction) Create a report as follow: Last four digits of SSN, Employee’s first initial
and last name, Hours worked, Hourly rate, Gross pay, Total deductions, and Net pay. You may have to use “substr” for SSN and Employees first initial.
Make sure you have number of records and thank you note as a summary at the bottom
Create a class Complex to represent complex number. Using this pointer perform addition of two complex numbers.
Member function for adding A=A+B
Complex Add(Complex B)
{
//use this for accessing Object A of Complex class
}
Based on the question below, write a program using :
a. For loop
b. While loop
c. Do..while loop
Calculate the salary that employee get based on number of working. Rate of the payment is RM8.00 per hour but the salary will be deducted with 10% KWSP. By using a repetition control structure, write a program to calculate the total salary of 5 employees and the average salary of the employee.
Based on the question below, write a program using :
a. For loop
b. While loop
c. Do..while loop
A class of ten students took a quiz. The mark is between the ranges 0 - 25 for this quiz is available to you. Determine the average mark for this quiz. Based on this problem, you are required to create a program.
Mean, Median and ModeGiven a list of integers, write a program to print the mean, median and mode.
Mean - The average value of all the numbers.
Median - The mid point value in the sorted list.
Mode - The most common value in the list. If multiple elements with same frequency are present, print all the values with same frequency in increasing order.Input
The input will be a single line containing space-separated integers.Output
The first line of output should contain the mean, round off the value to 2 decimal places.
The second line of output should contain the median, round off the value to 2 decimal places.
The third line of output should contain the mode.
Mean should always be a float value.
Median should be a float value when there are even number of elements, otherwise should be an integer value.
See Sample Input/Output for the output format.Explanation
2 4 5 6 7 8 2 4 5 2 3 8The average of all the numbers is 4.67.
After sorting the array,
2 2 2 3 4 4 5 5 6 7 8 8
Write small programs to demonstrate the behavior of the constant variable,
constant pointer, constant pointer to constant variable and passing constant
pointer to the function.
Q.2. Copy constructor
Define class Student with the following attributes and member functions:
i. Date of Birth (constant data member)
ii. Pointer to char for name
iii. Pointer to char for Department
iv. Student ID (constant data member)
v. Member function Constructors
vi. Member function Destructor
vii. Member function to modify state of the object
viii. Member function to display state of the object (should be
constant)
Note that pointers in (ii) and (iii) should point to the dynamic memory allocated
for name and Department name. Get information of the student object in
constructor. Memory for name and Department will be allocated in constructor
using dynamic memory allocation. Destructor will release memory to the
operating system.
Q.3. Extend Q.2 for shallow and deep copy constructor.
Constructor
Objective: Design and implement a class Time which has constructor and destructor
member function. You class should use multiple constructors and a destructor.
Define class for Time considering the followings:
a. Enlist data members and methods with access specifies.
b. At least one member function and data members should be constant