Worker having id(int), name(Sting), hoursWorked(int), salRate (double).a method addHours(int h) that increase the number of hoursWorked by the provided value.getCurrentSalary()that calculates and returns the current salary i.e. the hoursWorked times the salRate. class Project with id(int),desc (String), duration (int), budget (double) and members (ArrayList of Workers).methodaddMember(Worker m) that adds the worker instance to the members array list.a method Worker getMember(int wId) that searches for the worker with the given id in the members list and returns instance.Provide a method addMemberHours(int wId,int h) that finds the Worker with the wID in the members list and then adds worker hours to the instance. These many hours should also be added to the duration of this project,getTotalCost() that calculates the total cost of the project by summing the budget and the salary of each member of the project. The salary of each member can be found by calculating an appropriate method of the Worker class.
Hope Michael, a DBIT student did 8 units in an exam and got different marks in each of the exam papers. She intends to calculate her total, mean score and exams verdict for the exams using a program written in C++.
Requirements/Guide. (All the instructions below should be done in the same single program)
i. Assign 8 scores to Hope in a one-dimensional array.
ii. Declare a function that takes an array of Hope’s scores as a parameter and calculates both
the total and the mean score.
iii. Pass the mean score from (ii) above into another function by reference, that computes whether Hope has passed or not given that a pass is 50 – 100 while a fail is 0 – 49.99 Marks.
iv. Display Hope’s results as follows: (this is a sample output, use arbitrary values in your
solution)
Student Name: Hope Michael
Test Scores:
Total Marks:
Mean Score:
Exams Verdict: Pass
40, 50, 60, 80, 98, 82, 70, 32
Company ABC in Kenya pays its employees based on a commission of the sales they make as illustrated in the table below:
Monthly Sales
Next 100,000
Above 350,000
Commission Rate
15%
25%
First 50,000
10%
Next 200,000
20%
Additionally, all employees are entitled to a basic commission of 20,000 per month.
a. Draw a flowchart that allows a HR employee to input an employee’s monthly sales, computes the commission due to the employee and displays it to the HR employee.
b. Write a C++ program implementation of the flowchart above.
Provide a method getTotalCost() that calculates the total cost of the project by summing
the budget and the salary of each member of the project. The salary of each m ember
can be found by calculating an appropriate method of the Worker class
Build class Project with id(int), desc (String), duration (int) , budget (double) and members (ArrayList of Workers). Provide parameterized constructor Project (int id, String desc, double budget). The member array will be initialized as empty array and initial duration of project will be 0. Provide setters for description & budget & getters for all except members list. Provide method addMember(Worker m) that adds worker instance to members array list. Provide a method Worker getMember(int wId) that searches for worker with given id in members list and returns instance. Provide a method addMemberHours(int wId, int h) that find Worker with wID in members list and then adds worker hours to instance. These many hours should also be added to duration of this project.( Also add 5 to the duration of this project). Provide method getTotalCost() to calculate total cost of project by summing budget and salary of each member of project. Override toString method to get output.
by CodeChum Admin
Instructions:
Input
The first line contains an integer n which is the size of the array.
The next n lines contains a string on each.
The last line contains an integer which is the index to be accessed and printed.
6
Learning
Programming
made
easy
with
Cody!
5Output
A line containing a string.
Cody!by CodeChum Admin
Did you know that you can also reverse lists and group them according to your liking with proper code? Let's try it to believe it.
Instructions:
Input
The first line contains an odd positive integer.
The next lines contains an integer.
5
1
3
4
5
2Output
A line containing a list.
[2,5]-[4]-[3,1]Make a program that will accept an integer and loop for the same number of times as that of the inputted integer and input random integers and add it to the array/list one by one, per line. Afterwards, make your program accept another random integer.
Using that final integer, compare from your array/list if the final integer's value is also present in your current array/list. If so, print "Present"; otherwise, print "None".
Start coding now!
Input
The first line contains the size of the array/list.
The next lines contain the integers.
The last line contains an integer to be searched.
5
3
21
2
5
23
2Output
A line containing a string.
PresentBuild a class Department having id(int), address(String) and Project(array list of projects) and Worker(array list of members). Provide a method addProject(int id, String description, double budget) that creates project and adds it to project list. Provide method addWorkerToProject(int projId, int wId) that searches for project with projId from projects list and worker with wId from members lists and adds member to project (you will call appropriate method of project class that will add member to project. Provide a method getProjectCost(int pid) which searches for project with given id from projects list and returns its total cost (you can call method from project class to get total cost) . Provide a method getDepartmentTotalBudget() that calculates total cost of each project of the department and adds it up to get total budget (call appropriate method of Project instances for project costs) .Provide toString of department so that it outputs all details including each project and members in each project.
Build a class Worker having id(int), name(Sting), hoursWorked(int), salRate (double)
a. Provide a constructor Worker(int id, String name, double salRate). The hoursWorked will
be initially 0
b. Provide getters for each but setters for only salRate
Provide a method addHours(int h) that increase the number of hoursWorked by the
provided value.
d. Provide a method getCurrentSalary() that calculates and returns the current salary i.e.
the hoursWorked times the salRate.
e. Override the toString to get appropriate output