uS Java/C++ IF Assignment 3-100 points Due date- Sept 24 You are to write a prog
ID: 3888439 • Letter: U
Question
uS Java/C++ IF Assignment 3-100 points Due date- Sept 24 You are to write a program to do the following: (input data of your choice) Read in the number patients having knee surgery Read in the total fees charged to those patients Read in the name of the Doctor doing the knee surgeries . . Read in the number patients having hip surgery Read in the total fees charged to those patients Read in the name of the Doctor doing the hip surgeries . . Read in the number patients having heart surgery Read in the total fees charged to those patients Read in the name of the Doctor doing the heart surgeries Print all of the data read in gto Calculate and print the total fees paicd Calculate and print the average of all fees paid Print the type of surgery that had the highest fees paid Print the Doctor who had the highest fees Print the Doctor who did the highest amount of surgeries Copy the source code to word. Copy a screen shot of the final output to the same word document Upload the document to blackboard .Explanation / Answer
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
char name[20], name1[20], name2[20];
int n, n1, n2;
float fees, fees1, fees2, total, average;
cout<<" Details for Knee Surgey";
cout<<" Enter the number of patients having Knee Surgery: ";
cin>>n;
cout<<" Enter the total fees for those patients: ";
cin>>fees;
cout<<" Enter the Name of the Doctor doing the Knee Surgeries: ";
cin>>name;
cout<<" Details for Hip Surgey";
cout<<" Enter the number of patients having Hip Surgery: ";
cin>>n1;
cout<<" Enter the total fees for those patients: ";
cin>>fees1;
cout<<" Enter the Name of the Doctor doing the Hip Surgeries: ";
cin>>name1;
cout<<" Details for Heart Surgey";
cout<<" Enter the number of patients having Heart Surgery: ";
cin>>n2;
cout<<" Enter the total fees for those patients: ";
cin>>fees2;
cout<<" Enter the Name of the Doctor doing the Heart Surgeries: ";
cin>>name2;
cout<<" Details for Knee Surgey";
cout<<" Enter the number of patients having Knee Surgery: " <<n;
cout<<" Enter the total fees for those patients: "<<fees;
cout<<" Enter the Name of the Doctor doing the Knee Surgeries: "<<name;
cout<<" Details for Hip Surgey";
cout<<" Enter the number of patients having Hip Surgery: "<<n1;
cout<<" Enter the total fees for those patients: "<<fees1;
cout<<" Enter the Name of the Doctor doing the Hip Surgeries: "<<name1;
cout<<" Details for Heart Surgey";
cout<<" Enter the number of patients having Heart Surgery: "<<n2;
cout<<" Enter the total fees for those patients: "<<fees2;
cout<<" Enter the Name of the Doctor doing the Heart Surgeries: "<<name2;
total = fees + fees1 + fees2;
average = total / 3;
cout<<" Total Fees Paid = " <<total;
cout<<" Average of all Fees = " <<average <<"%";
if(fees >= fees1 && fees >= fees2)
cout<<" The Highest Fees paid for the Surgery is Knee Surgery";
if(fees1 >= fees && fees1 >= fees2)
cout<<" The Highest Fees paid for the Surgery is Hip Surgery";
if(fees2 >= fees && fees2 >= fees1)
cout<<" The Highest Fees paid for the Surgery is Heart Surgery";
if(fees >= fees1 && fees >= fees2)
cout<<" The Doctor who had the Highest Fees is: " <<name <<" and " <<fees;
if(fees1 >= fees && fees1 >= fees2)
cout<<" The Doctor who had the Highest Fees is: " <<name1 <<" and " <<fees1;
if(fees2 >= fees && fees2 >= fees1)
cout<<" The Doctor who had the Highest Fees is: " <<name2 <<" and " <<fees2;
if(n >= n1 && n >= n2)
cout<<" The Doctor who did the Highest Amount of Surgeries is: " <<name <<" and " <<n;
if(n1 >= n && n1 >= n2)
cout<<" The Doctor who did the Highest Amount of Surgeries is: " <<name1 <<" and " <<n1;
if(n2 >= n && n2 >= n1)
cout<<" The Doctor who did the Highest Amount of Surgeries is: " <<name2 <<" and " <<n2;
return 0;
}
OUTPUT
Details for Knee Surgey
Enter the number of patients having Knee Surgery: 2
Enter the total fees for those patients: Sanjay
Enter the Name of the Doctor doing the Knee Surgeries: 10000
Details for Hip Surgey
Enter the number of patients having Hip Surgery: 4
Enter the total fees for those patients: 20000
Enter the Name of the Doctor doing the Hip Surgeries: Karthick
Details for Heart Surgey
Enter the number of patients having Heart Surgery: 1
Enter the total fees for those patients: 5000
Enter the Name of the Doctor doing the Heart Surgeries: Sheela
Details for Knee Surgey
Enter the number of patients having Knee Surgery: 2
Enter the total fees for those patients: 10000
Enter the Name of the Doctor doing the Knee Surgeries: Sanjay
Details for Hip Surgey
Enter the number of patients having Hip Surgery: 4
Enter the total fees for those patients: 20000
Enter the Name of the Doctor doing the Hip Surgeries: Kathick
Details for Heart Surgey
Enter the number of patients having Heart Surgery: 1
Enter the total fees for those patients: 5000
Enter the Name of the Doctor doing the Heart Surgeries: Sheela
Total Fees Paid = 35000
Average of all Fees = 11666.7%
The Highest Fees paid for the Surgery is Hip Surgery
The Doctor who had the Highest Fees is: Kathick and 20000
The Doctor who did the Highest Amount of Surgeries is: Kathick and 4
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.