C++ :: Program To Compute And Print A Billing Statement For Each Patient

Oct 17, 2013

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

TOTAL DUE = $642.50

View 3 Replies


ADVERTISEMENT

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.

#include<iostream>
using namespace std;
double in_patient(int Numdays, double dailyRate, double Charge_hospServices, double HospMed_Charge);
double out_patient(double Outcharge_Service, double OuthospMed_Charge);
int main() {

double dailyRate, Charge_hospServices,HospMed_Charge,Outcharge_Service,OuthospMed_Charge;

[Code] .....

View 4 Replies View Related

C++ :: Billing Program For A Bakery

Jul 25, 2014

So, the point of this program is to make simple billing program for a bakery. The program starts by having the cashier enter in the prices for single muffin, a half-dozen, and a dozen muffins. Then, the cashier enters in the amount that the customer wants. Based on the amount entered, the program will return the best offer. (For example, if the customer wants 11 muffins, but the price of 11 individual muffins is greater than the price of a dozen muffins, the program will recommend the customer by a dozen muffins). I'm having trouble getting my program to do the calculations correctly. I think my algorithm is correct, but it's not displaying properly.

#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;
class Bakery {

[Code] ....

View 7 Replies View Related

C++ :: Program For Billing System - Regular Package Function

Jan 5, 2015

I have programmed a program for billing system. I have used parameters and arrays. All the functions are working except a one function. (Regular package function).

#include <iostream>
#include <fstream>
#include <string>
#include <ctime>
using namespace std;
void main(int &minutes, int &minutesd,int &minutesn) {

[Code] .....

View 3 Replies View Related

C++ :: Functions Without Parameters - Compute And Print Total Number Of Products For Company

Mar 27, 2013

Summary: 6 companies have a product in 5 different warehouses. Each company is identified by a positive ID number and each warehouse is identified by a number (1 for the first, 2 for the second,…)

Object: the object of this assignment is to write a C++ program which asks the user to enter a company ID number, and the number of products in each of the warehouses. It then computes and prints the total number of products for that company

If the total number of product is less than 100, it prints the message “place a new order”

Input: for each company, its ID, and the number of products in each warehouse with appropriate prompt messages.
Example: Enter company ID number: 101
Enter number of products in warehouse #1:30
Enter number of products in warehouse #2:60
Enter number of products in warehouse #3:0
Enter number of products in warehouse #4:5
Enter number of products in warehouse #5:27
The total for company 101 is:122

Output: for each company, the total number of product, and the message “place a new order” if the total number of product is less than 100.

Method:
1. Define global variable, int total_prod to hold the total number of products for a company
2. define the function void compute_total() that uses a loop to read the number of the products in all warehouses for one company, computer the total number of products and store it into the global variable total_prod.
3. Define the function void new_order() that determines if a new order need to be placed as follows: if the total number of products (in the global variable total_prod) is less than 100, it prints the message “place a new order”
4. Your function main does the following in a loop:
- read a company ID number
- call function compute_total() to read the number of the product in all warehouses for that company, and to compute their sum
- print the total number of the product for that company with an appropriate message
- call the function new_order() to determine if a new order need to be placed.

View 17 Replies View Related

C :: Read Amount Of Order From Standard Input / Compute And Print Total Price After Discount

Apr 13, 2014

A Bookseller makes special discount for multiple orders of a book as follows:

AMOUNT and DISCOUNT as follows.

5-9 5% 10-14 10% 15-19 15% 20+ 20%

Write a C main function to read the amount of order from the standard input and compute and print the total price of the given order after the discount. Assume that unit price of a book is 10.00$

My problem is that.When i start with this

Code:
#include<stdio.h>
#include <stdlib.h>
int main(void)
{
int number;
float TotalPrice;
printf("enter a number:");

[Code] ....

I get 0 if i enter a number between 0 and 4(0 and 4 included). I don't know where I am doing a mistake. I also want to know if i can handle this buy just if statements. or how can i do it by while and for loops ?

View 1 Replies View Related

C/C++ :: Using Print Statement To Print Certain Number Of Spaces

Sep 1, 2014

is there a to use printf to print certain number of blank spaces, where the number is derived from the output of a function?

for(m=low; m<=high;m++)
{
printf("t=%2d %'f(m)-1's %3c", m, ' ',*);
}

This is suppose to output

t=-3 *
t=-2 *
t=-1
.
.
.

View 2 Replies View Related

C :: Flowchart - Program To Compute Average Of N Numbers

Feb 20, 2015

How can you draw a flow chart that will be used to write a program to compute Average of n numbers?

View 1 Replies View Related

C++ :: Write Program That Uses Function To Compute The Cost?

Nov 1, 2013

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.

diameter=17
number of toppings=3

//complier directives
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdlib>

[Code].....

View 6 Replies View Related

C++ :: Print Statement Without Spaces

Apr 13, 2013

i am trying to write a program to print a statement without spaces in it.For example, if the statement is "Hello, i am Solidsnake", then it should print it as "Hello,iamsolidsnake".

View 4 Replies View Related

C :: Program Doesn't Properly Compute Simple Polynomial

Feb 7, 2014

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;
}

[code]...

View 5 Replies View Related

C++ :: Program That Compute Final Average Grades Of Class

Jan 28, 2013

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:

Exam 1 – 30%
Exam 2 – 30% Quiz 1 – 10%
Quiz 2 – 10%
Quiz 3 – 10%
Quiz 4 – 10%

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.

View 1 Replies View Related

C/C++ :: Program To Compute Length Of String Entered By User By Class

Sep 30, 2014

I want this program by using only iostream.h & conio.h

View 4 Replies View Related

C :: Take Averages Of Whole Week And Output Print Statement

Jul 17, 2013

I wanted to take the averages of the whole week and output a print statement. I've tired few ways this like assigning "temp" a pointer, or in each if statement assigning temp to a new variable like a, b , c etc. Then adding them all up at the end and dividing by 7. My issue is I am unclear how to store the number typed for each if statement while the program is running, then have it compute the simple equation. The code in question is below:

Code:
#include <stdio.h>
int main(int argc, const char * argv[]) {

int i, j = 0, temp = 0;
for (i=1; i<=7; i++) {
j++;

[Code] ....

View 1 Replies View Related

C/C++ :: Using Printf Statement To Print Certain Number Of Spaces

Sep 1, 2014

is there a to use printf to print certain number of blank spaces, where the number is derived from the output of a function?

for(m=low; m<=high;m++)
{
printf("t=%2d %'f(m)-1's %3c
", m, ' ',*);
}

this is suppose to output

t=-3 *
t=-2 *
t=-1
.
.
.

This is supposed to output t=m and then m is plugged into a function say for -3, plugging it into function f gives 23, well i want 22 blank spaces and then a asterik and go to next line. that is why i put -1 after %'f(m)-1's i

The asterisk appear right next to the t value here but they are way to the right of it when i made this post.

View 2 Replies View Related

C++ :: Print Numbers At Random From A Set Using Single Statement

Jan 21, 2012

I have an exercise that asks me to print numbers at random from the following set (using only a single statement):

2, 4, 6, 8, 10

Here's my statement:

Code:
cout << (2 + rand() % 9) << " ";

which prints numbers at random between 2 and 10, now I can use the modulus operator in an if...else statement to print only even numbers but the exercise specifically requires using only one statement, can that be done using the conditional operator? and if not then how?

View 10 Replies View Related

C# :: Infinite Loop Random Boolean Print Statement

Feb 19, 2014

I am working on a small simple program my program fills up a air plane with customers there is 2 levels 1 and 2 and it will put that person in the spot depending on being picked.

So far i made a boolean airplane with 10 spots I can enter 1 person into the airplane with no problem but then after he sits down i get a infinite loop? I assume i maybe have to use the continue statement I feel like there is something simple that im missing i want to add more people. here is what i have

class Program
{
static void Main(string[] args)
{ bool[] planeSeats = {false, false, false, false, false, false, false, false, false, false };

[Code]......

View 1 Replies View Related

C++ :: User Defined Program - Compute Price Per Square Inch Of Cake Using Overloading

Nov 21, 2014

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);

[Cpde] .....

View 4 Replies View Related

C :: Loop Statement To Print Numbers From 1 To 10 In Reverse Order Separated By Star

Apr 21, 2013

Write a for loop statement to print the numbers from 1 to 10 in reverse order separated by star :

10*9*8*7*6*5*4*3*2*1

i try to do it but it show me like this :

10*9*8*7*6*5*4*3*2*1*

how do i write to show me like the first one ?

View 10 Replies View Related

C/C++ :: Create Billing System Without Using Pointers - Array Calculations

Feb 17, 2014

I am trying to create an billing system "without using pointers". This is my class assignment. In this,

1) User inputs the name
2) The system asks how many items he has purchased
3) Displays a bill number [just a random number]
4) System asks for the item names the user purchased and stores them in an array (of max 10 (ten) inputs (or items))
5) After each item the user inputs, the system asks for the price of the item (stored in an array of numbers)
6) The total bill is calculated, by adding the sum of all prices in the array

I am having terrible difficulties in coding #4 and #5. Somehow, they aren't going well together. Here's what I have:

#include<stdio.h>
#include <stdlib.h>
int main() {
char item[10][10], answer = 'y', name;
int price[10], total_item, total_price = 0, i, j, a, total_bill = 0, max_items = 10, max_char = 10;

[Code] ....

You might find a lot of unused variables

View 10 Replies View Related

C/C++ :: Program To Compute Students Grades From File And Write Them To File?

Aug 31, 2014

We have to write a program that reads an input file containing data in the form:

Martha J, 80, 90, 90, 100, 89, 99, 85
Anna Smith, 65, 72, 77, 68, 62, 70, 65
Bill Gates, 60, 54, 89, 62, 65, 60, 50
...etc...

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.

View 2 Replies View Related

C :: Doing Program With If Statement That Recognizes Letters

Oct 15, 2013

Im still new to this but i dont quite understand whats wrong with this code

Code:
#include <stdio.h>
int num1, num2, num3;
char resp;
int main()
{
printf("Quer os seus numeros em ordem crescente ou decrescente?

[Code] ....

It is in portuguese but the thing is, when i type the C when it asks for the response it still reads as if it was D the response

View 5 Replies View Related

C++ :: Program Enters If Statement Even Though Requirements Not Met

Jul 25, 2014

My program gets user input and compares it against an array of characters (guessLetters[x]) to decide whether the do/while loop repeats. The whole character array contains underscores yet if i enter any letter it goes into the if statement and repeats the do/while loop.

do {
repeatflag = false;
cin >> UserInput;
UserInput = toupper(UserInput);

[Code] .....

View 2 Replies View Related

C/C++ :: How To Use Switch Statement 2 Times In A Program

May 10, 2012

How can we use switch statement 2 times in a program?

View 2 Replies View Related

C/C++ :: How To Put All Questions In One Program By Using Switch Statement

Mar 22, 2013

How to put my all assignment questions that are 6 in number in one program by using switch statement ?

so if a user wants to see any question by choice!

View 1 Replies View Related

C :: Program That Have Starting Menu For A Calculator Using If / Else Statement

Sep 21, 2014

I just started learning C and trying to create a program in C that will have a starting menu for a calculator. The problem is that I could do that with a switch/case but the assignment requires me to use if/else.

Here's what I have so far:

Code:

#include <stdio.h>
int calc();
int menu();
int main() {
printf("Hello. Welcome to the program.
");
printf("Press RETURN key to continue...

[Code]...

How should I go from now using if/else to have those 4 choices?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved