My professor said that my code needs to look more original. can you give me tips or show me what else I can do to make the code look more original? here's the code: #include #include #include using namespace std; int main() { //variables and constants int package; double data; double totalCharges = 0.0; cout << "iMobile Bill Calculator ..." << endl; // When the package entered is not valid while (true) { cout << "\nSelect a subscription :" << endl;; cout << "\t\t1. Package A" << endl; cout << "\t\t2. Package B" << endl; cout << "\t\t3. Package C" << endl; cout << "Package: "; cin >> package; if (package >= 1 && package <= 3) break; else cout << "Error ... Invalid package. Try again." << endl; } // When Gigabytes entered is not valid while (true) { cout << "\nHow many gigabytes of data were used? "; cin >> data; if (data < 0) { cout << "Error ... Invalid gigabytes entered. Try again." << endl; } else break; } switch (package) { // Monthtly Charges for Plan A case 1: { if (data >= 0 && data <= 4) { totalCharges = 39.99; } // Monthtly Charges for Plan A with additional data costs else { totalCharges = 39.99 + (data - 4) * 10; } break; } // Monthtly Charges for Plan B case 2: { if (data >= 0 && data <= 8) { totalCharges = 59.99; } // Monthtly Charges for Plan B with additional data costs else { totalCharges = 59.99 + (data - 8) * 5; } break; } // Monthly Charges for Plan C case 3: { totalCharges = 75; break; } } // Display the monthly total amount cout << "The total amount due is $" << totalCharges << endl; cout << endl; return 0; }
My professor said that my code needs to look more original. can you give me tips or show me what else I can do to make the code look more original?
here's the code:
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main()
{
//variables and constants
int package;
double data;
double totalCharges = 0.0;
cout << "iMobile Bill Calculator ..." << endl;
// When the package entered is not valid
while (true) {
cout << "\nSelect a subscription :" << endl;;
cout << "\t\t1. Package A" << endl;
cout << "\t\t2. Package B" << endl;
cout << "\t\t3. Package C" << endl;
cout << "Package: ";
cin >> package;
if (package >= 1 && package <= 3)
break;
else
cout << "Error ... Invalid package. Try again." << endl;
}
// When Gigabytes entered is not valid
while (true) {
cout << "\nHow many gigabytes of data were used? ";
cin >> data;
if (data < 0) {
cout << "Error ... Invalid gigabytes entered. Try again." << endl;
}
else
break;
}
switch (package) {
// Monthtly Charges for Plan A
case 1: {
if (data >= 0 && data <= 4) {
totalCharges = 39.99;
}
// Monthtly Charges for Plan A with additional data costs
else {
totalCharges = 39.99 + (data - 4) * 10;
}
break;
}
// Monthtly Charges for Plan B
case 2: {
if (data >= 0 && data <= 8) {
totalCharges = 59.99;
}
// Monthtly Charges for Plan B with additional data costs
else {
totalCharges = 59.99 + (data - 8) * 5;
}
break;
}
// Monthly Charges for Plan C
case 3: {
totalCharges = 75;
break;
}
}
// Display the monthly total amount
cout << "The total amount due is $" << totalCharges << endl;
cout << endl;
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps