C++ :: Program To Compute And Display Charges For Patient Hospital Stay
Dec 6, 2013
Write a program that computes and displays the charges for a patient's hospital stay. First, the program should ask if the patient was admitted as an in-patient or an out-patient. If the patient was an in-patient the following data should be entered:
-Number of Days spent in a Hospital
-The daily rate
-Charges for the hospital services(lab test, etc)
-Hospital medication charges
If the the patient was an out-patient the following data should be entered:
-Charges for Hospital services(lab test, etc)
-Hospital medication charges
The program should use two functions to calculate the total charges. One of the functions should accept arguments for the in patient data, while the other function accepts arguments for out-patient data. Both functions should return the total charges.
I dont know why but the result always gives me 0??? This is what I have.
Community Hospital needs a program to compute and print a billing statement for each patient. Charges for each day are as follows:
a. room charges: private (P) room = $125.00; semi-private (S) room = $95.00; or ward (W) = $75.00 b. telephone charge = $1.75 c. television charge = $3.50
Write a program to get data from the keyboard, compute the patient’s bill, and print an appropriate statement. Typical input (nut yours do not have to be identical to this) is the following:
How many days was the room occupied? 5 What type of room? P Telephone used during the stay? N Television used during the stay? Y
Keep in mind that the user needs to know that the input can be any integer number of days for the length of stay, either (P, S, or W) for the room type, and either (Y or N) for both telephone and television options.
A statement (which yours MUST be identical to) for the data given follows:
Community Hospital Patient Billing Statement
Number of days in hospital: 5 Type of room: Private Room charge:$ 625.00 Telephone charge:$ 0.00 Television charge:$ 17.50
My program closes after the out even though i've used cin.get():
I want the program to stay open at least until you press enter, even after the whole output.
Code: #include <iostream>#include <string> int main() { std::cout << "Please enter your name"; std::string name; std::cin>> name; // build the message that we intend to write
Write a program that uses a function to compute the cost of a pizza with given diameter and the number of toppings. Constant will be the cost per toppings and cost per square inch. It will contain a reputable structure as well.
The program will ask for the user to enter a value for x, then compute the following polynomial: 3x^5 + 2x^4 - 5x^3 - x^2 + 7x - 6.However, when I double check it with my calculator I get a wrong answer for random values of x. To simplify my problem I'm using only integers.
Code:
#include <stdio.h> int main(void) { int x, polynomial; }
An instructor needs you to write a program that will compute the final average grades in her class. There are 5 students in the class. Each student must take 2 exams and 4 quizzes as part of their final grade. The weight of each toward the final grade is as follows:
You must use arrays to store each students 3 digit ID number, exam scores and quiz scores. A multi-dimensional array is mandatory. Request from the user the information needed then output all of the information as well as the final average grade for each student.
I'm currently working on a program that calculates shipping charges. However I'm stuck, whenever I compile the program the total amount at the end always comes up as my flat rate variable and not the total calculated number.
Create a user-defined program that will compute the price per square inch of a cake using an “overloading”. The cake could be a circle or a square type. In the main function, ask for the price of a circle cake and its diameter, while for the square cake, ask for the price, its length and width. The process must be done inside the different function of each cake. (Note: two sub function for the computation of a circle and a rectangle)
Note that when I made this program something weird happen. After inserting the name, all things follow.
<code> #include "stdafx.h" #include <iostream> using namespace std; double areaRectangle(int l, int w); double radiusCircle(int r);
It's based off of deWitter's 4th game loop. [URL]....
However, there's one major flaw. If the update() function takes a long time to execute, the timer slows down, a "second" doesn't last 1000 milliseconds, and the fps counter spits out numbers like 100 and 120 when the limit should be 60. Is there a way to make a timer that always runs with constant speed no matter how long the update function takes?
I have a function that rotates a vector 90 degrees. Only problem is, i never get negative values. For some strange reason, no matter what i do, the value of x is positive. And even if the x is negative. Once i put it into direction (struct with 2 values x and y) it turns again to positive. Im using VSC++2013 ultimate. At first direction was SDL_Point, so i thought it was SDL problem, but now it seems its something else.
if (c == '-') { int x = direction.y; x *= -1; int y = direction.x; direction = { x, y }; }
and then use that information to determine their letter grade and write that information to a .txt file. I have been able to successfully pass that information to a function to determine their letter grade and have been able to successfully compute their letter grade. However, I can get this information to successfully post within the *computeGrade () function. Yet, I don't know how to pass this information back to the main() on a student by student basis so that I can open a new .txt file and write just their name and letter grade to it.
Another issue I'm having is when it comes to computing the averages of the class. Each score is either a quiz (there are 4), a midterm (there are 2) or a final (there is 1). I'm a little stuck on how to pass say all of the quiz 1 grades as one entity to the function averagesminmax(). Is there a way to compile each of the grades for a specific quiz or midterm as one array and pass that to the function to then do the computation. Also we need the min and max so again from compiling the grades of a particular quiz or exam together as one.
Here's the code that I have so far.
#include <stdio.h> #include <stdlib.h> #include <math.h> const char *computeGrade(); int averagesminmax(); int main() { char fName[20]; char lName[20];
[code]....
Do I need to re-read the input file and assign them to different variables?
Here's a sample of the output so far:
Enter input .txt file name Graded Thui Bhu, 91, A Ariana B. Smith, 96, A Emily Gonzales, 83, B Jennifer L, 89, B Maria Jones, 67, D Bill Gates, 55, F Escobar Morris, 78, C Anne Latner, 88, B Program ended with exit code: 0
Also in my output file, the only thing that it prints will be the first name of whatever the last student in the input file list is.
I am writing a game that is 2 to 4 players. i am wondering how to ask how many players, and make the score stay with each player. it is a rip off of zombie dice, this is what i have so far the playerScore array is to hold the score for each player and the turn array is hold hold the values that they rolled that turn, i also dont know how to clear out the turn array when it goes to the next player.
#include <iostream> #include <cstdlib> #include <cmath> #include <ctime> using namespace std; int main() { int playerScore[4];
i wrote this program to display even number from 100-200. But visual c gives me this error with undeling the "a" in if statement. Error1error C2106: '=' : left operand must be l-value
I intended to compute perimeter of a triangle. The problem is the initial value for the triangle.
#include <iostream> #include <cmath> using namespace std;
struct Point{ double x; double y;
[Code] ......
I expect to get 0 for triangle1, but I get some strange value...
Here is the result
Type x for point1 : 1 Type y for point1 : 1 Type x for point2 : 3 Type y for point2 : 1 Type x for point3 : 1 Type y for point3 : 3 The perimeter of the triangle1 is : 2.82843 The perimeter of the triangle2 is : 6.82843
I am trying to do a compute and output a power set program. The numbers will be input through a file. How to do a power set. Here is my code :
#include <iostream> #include <fstream> #include <string> #include <ostream> using namespace std; int main () { string array[21]; // creates array to hold names
Write a program that displays the first 40 Fibonacci numbers. A Fibonacci number is created by add the previous two, with the first two always being 0 and 1. A partial sequence is as follows:
0, 1, 1, 2, 3, 5, 8, 13, 21,….
Your table must display 6 numbers per row and use a spacing of 10 for each number. Don’t forget to include the header file “iomanip” at the top and use “setw()”. You will need to turn in an algorithm, source code and output.
Here is what i have but i get errors!
#include <iostream> using namespace std; { int FirstNumber = 0; int SecondNumber = 1; int NumberOfNumbers = 2; int NewNumber;
Also is there a way to display the time only instead of the date? How will i change the program to display the time in standard 12 hours, instead of 24 hours?
#include <iostream> #include <time.h> using namespace std; int main() { time_t tim; time(&tim); cout << ctime(&tim); }
Write a program that asks the user to enter the number of calories and fat grams in a food item. The program should display the percentage of the calories that come from fat. One gram of fat has 9 calories, so:
(Calories from fat) = (fat grams) * 9
The percentage of calories from fat can be calculated as:
(Calories from fat) / (total calories)
Extend as follow
1. The user first enters from a menu whether it is breakfast (B or b), lunch (L or l) or dinner (D or d). Use character and process by a switch. 2. The threshold for low calorie is different, for breakfast 10%, lunch 20%, dinner 30% (this value has to be assigned to some threshold variable in the above switch). 3. Include validation of menu choice. 4. In case any validation fails, display detailed error and exit the program by calling return 1 or return EXIT_FAILURE 5. Display the % from fat with one decimal digit.
Example 1: What you have to eat: B - breakfast L - lunch D - dinner What you have: C Error: C is not a valid menu choice
Example 2: What you have to eat: B - breakfast L - lunch D - dinner What you have: L How many calories: 600 How many grams of fat: 10 Your food has 15.0% calories from fat It is a low calories food
Process the menu in a switch, setting the threshold as either 10, 20, or 30%. The rest of the program will be the same regardless what was the menu choice.
Incremental development: first do the textbook problem without input validation, then extend with validation, then extend for the additional parts.