Thanks for the question.
Here is the completed code for this problem. Comments are
included so that you understand whats going on. Let me know if you
have any doubts or if you need anything to change.
Thank You !!
============================================================================================
#include<iostream>
#include<iomanip>
using namespace std;
// takes in the float array and populate the amount
// keep asking the user to enter the purchase amount
// until the id is less than 0 or greater than 6
void purchases(float tabs[]){
int id=0;
float purchaseAmount=0.0;
while(0<=id && id<=6){
cout<<"Enter employee ID: (0
- guest, 1-6 for workers): ";
cin>>id;
if(0<=id &&
id<=6){
cout<<"Enter purchase amount: $";
cin>>purchaseAmount;
tabs[id]+=purchaseAmount;
}
}
}
// takes in the tabs array and print the bill for each
worker and guest
void printBill(float tabs[]){
cout<<fixed<<showpoint<<setprecision(2);
for(int id=0;id<7;id++){
if(id==0)
//cout<<"Guest. Total
Purchase Amount $"<<tabs[id]<<endl;
else
cout<<"Worker"<<id<<" Total Purchase Amount
$"<<tabs[id]<<endl;
}
}
int main(){
float tabs[7]{0.0}; // index 0 is for guest
purchases(tabs);
printBill(tabs);
}
========================================================================================
In c++ please!! An office with six workers maintains a snack bar managed on the honor...
In C# You will be prompting the user for a text string a list of bills they have every month. a. This should be a comma separated list , bill1, bill2, bill3 b. Validate that this text string is not left blank. 3. Create a custom function called CreateBillArray a. This function should accept the string variable that holds the bills. b. Inside of the function, split the text string of the bills into a string array with each individual...
Kindly solve this using C PROGRAMMING ONLY. 4. Write a program marks.c which consists of a main function and three other functions called. readmarks , changemarks (, and writemarks() The program begins by calling the function readmarks () to read the input file marksin. txt which consists of a series of lines containing a student ID number (an integer) and a numeric mark (a float). Once the ID numbers and marks have been read into arrays (by readmarks () the...
COSC 1437 C++ Project Assignment 2 Poll Summary Utilize a dynamic array of structure to summarize votes for a local election Specification: Write a program that keeps track the votes that each candidate received in a local election. The program should output each candidate’s name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. To solve this problem, you will use one dynamic...
In C++ please! Please include .cpp and .hpp files! Thank you! Recursive Functions Goals Create and use recursive functions In this lab, we will write a program that uses three recursive functions. Requirements: Important: You must use the array for this lab, no vectors allowed. First Recursive Function Write a function that recursively prints a string in reverse. The function has ONLY one parameter of type string. It prints the reversed character to the screen followed by a newline character....
Lottery Game (15 Numbers). Design and implement a C++ program that generates 15 random non-repeating positive integer numbers from 1 to 999 (lottery numbers) and takes a single input from the user and checks the input against the 15 lottery numbers. The user wins if her/his input matches one of the lottery numbers. Your implementation must have a level of modularity (using functions) Functions you need to implement: Define function initialize() that takes array lotterNumbers[] as a parameter and assigns...
C++ please use only easy code and stdio.h because im just a beginner Description Write the program that can manage the information of students as follows: S 1. This program has two phase; the input phase and the output phase. 2. In an input phase, a teacher inputs the information (name, score, and department) for each student. The total number of students who can be inputted should be defined as a NUM OF_STUDENT constant value. In this example, the value...
write a code on .C file Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...
Please solve only if you know how to do it. Write the code using C++ (not Python or Java). Show and explain everything neatly. COMMENTS (7.5% of programming assignment grade): Your program should have at least ten (10) different detailed comments explaining the different parts of your program. Each individual comment should be, at a minimum, a sentence explaining a particular part of your code. You should make each comment as detailed as necessary to fully explain your code. You...