------------------------------------------
#include
using namespace std;
int main()
{
const int retail_price = 99;
int num;
int cost;
float discount;
float purchase;
cout << "_____________________________________________________" << endl;
cout << "-------------------Software Sales--------------------" << endl;
cout << "_____________________________________________________" << endl;
cout << "The retail price = " << retail_price << endl;
cout << "Enter the number of units sold:" << endl;
cin >> num;
if (num > 0)
{
if (num >= 10)
{
if (num < 20)
{
cost = retail_price * num;
discount = (cost * 0.2);
purchase = cost - discount;
cout << "The total cost of the purchase with 20% discount = $" << purchase << endl;
}
}
if (num >= 20)
{
if (num < 50)
{
cost = retail_price * num;
discount = (cost * 0.3);
purchase = cost - discount;
cout << "The total cost of the purchase with 30% discount = $" << purchase << endl;
}
}
if (num >= 50)
{
if (num < 99)
{
cost = retail_price * num;
discount = (cost * 0.4);
purchase = cost - discount;
cout << "The total cost of the purchase with 40% discount = $" << purchase << endl;
}
}
if (num >= 100)
{
cost = retail_price * num;
discount = (cost * 0.5);
purchase = cost - discount;
cout << "The total cost of the purchase with 50% discount = $" << purchase << endl;
}
}
// for invalid input
else
{
cout << "Invalid:input!" << endl;
cout << "Please Enter the number greater than zero :" << endl;
}
return 0;
}
#include
using namespace std;
int main()
{
// Digits of a number
int num1 = 0;
int rem1 = 0; /*All values are initialize to zero to overwrite the garbage value*/
int rem2 = 0;
int rem3 = 0;
int rem4 = 0;
int rem5 = 0;
cout << "_____________________________________________________" << endl;
cout << "-------------------Palindrome Validation--------------------" << endl;
cout << "_____________________________________________________" << endl;
cout << "Enter the five-digit number:" << endl;
cin >> num1;
// Reminder 5
rem5 = num1 % 10;
// Reminder 4
num1 = num1 / 10;
rem4 = num1 % 10;
// Reminder 3
num1 = num1 / 10;
rem3 = num1 % 10;
// Reminder 2
num1 = num1 / 10;
rem2 = num1 % 10;
// Reminder 1
num1 = num1 / 10;
rem1 = num1 % 10;
// decisoions
if (rem1 == rem5)
{
if (rem2 == rem4)
{
cout << "It is a palindrome number:" << endl;
}
}
else
{
cout << "It is not a palindrome number:" << endl;
}
return 0;
}
#include
#include
using namespace std;
int main()
{
int binary;
int rem;
int cal;
int n=0;
cout << "_____________________________________________________" << endl;
cout << "-------------(Binary to decimal Calculator)----------" << endl;
cout << "_____________________________________________________" << endl;
cout<<"Enter the number in binary form:"<>binary;
//calculations
while(binary!=0)
{
rem=binary%10;
cal+=rem*(pow(2,n));
binary=binary/10;
n++;
}
//Display
cout<<"The binary to decial conversion = "<
#include
using namespace std;
int main()
{
int days;
int month;
int year;
int times;
cout << "_____________________________________________________" << endl;
cout << "-------------------Magic_Year_Validation-------------" << endl;
cout << "_____________________________________________________" << endl;
cout << "Enter the days:" << endl;
cin >> days;
cout << "Enter the month in numeric form like as june input as \"6\": etc:" << endl;
cin >> month;
cout << "Enter the last two digits of the year like as 1960 input as \"60\" etc:" << endl;
cin >> year;
// calculatios
times = month * days;
// Decisions
if (times == year)
{
cout << "WOW!.Its amazing the year is a magic year:" << endl;
}
else
{
cout << "Ops! The enter year is not a magic year:" << endl;
}
return 0;
}
#include
using namespace std;
int main()
{
float pennies;
float nickles;
float dimes;
float quarters;
float total;
cout << "_____________________________________________________" << endl;
cout << "-------------------Count Changing game---------------" << endl;
cout << "_____________________________________________________" << endl;
cout << "Enter the coins required exactly to make the one doller:" << endl;
cout << "Enter the pennies :" << endl;
cin >> pennies;
cout << "Enter the nickles :" << endl;
cin >> nickles;
cout << "Enter the dimes:" << endl;
cin >> dimes;
cout << "Enter the quarters :" << endl;
cin >> quarters;
// Calculations
pennies = (pennies * 0.01);
nickles = (nickles * 0.05);
dimes = (dimes * 0.1);
quarters = (quarters * 0.25);
total = pennies + nickles + dimes + quarters;
// Decisions
if (total == 1)
{
cout << "Congratulations! you won the game : It is equal to the one dollar:" << endl;
}
else if (total > 1)
{
cout << "The coins entered are greater than 1 dollar:" << endl;
}
else
{
cout << "The coins entered are less than 1 dollar:" << endl;
}
return 0;
}
#include
#include
using namespace std;
int main()
{
string string1, string2, string3;
int time1, time2, time3;
cout << "_____________________________________________________" << endl;
cout << "-------------------Running race----------------------" << endl;
cout << "_____________________________________________________" << endl;
cout << "Enter the name of the Player 1:" << endl;
cin >> string1;
cout << "Enter the time that took by player 1 to complete the race:" << endl;
cin >> time1;
cout << "Enter the name of the Player 2:" << endl;
cin >> string2;
cout << "Enter the time that took by player 2 to complete the race:" << endl;
cin >> time2;
cout << "Enter the name of the Player 3:" << endl;
cin >> string3;
cout << "Enter the time that took by player 3 to complete the race:" << endl;
cin >> time3;
// decisions
if (time1 > 0)
{
if (time2 > 0)
{
if (time3 > 0)
{
// Condition--1
if (time1 > time2)
{
if (time1 > time3)
{
cout << string1 << " comes first with in a time of " << time1 << endl;
if (time2 > time3)
{
cout << string2 << " comes second with in a time of " << time2 << endl;
cout << string3 << " comes third with in a time of " << time3 << endl;
}
if (time3 > time2)
{
cout << string3 << " comes second with in a time of " << time3 << endl;
cout << string2 << " comes third with in a time of " << time2 << endl;
}
}
}
// Condition--2
if (time2 > time1)
{
if (time2 > time3)
{
cout << string2 << " comes first with in a time of " << time2 << endl;
if (time1 > time3)
{
cout << string1 << " comes second with in a time of " << time1 << endl;
cout << string3 << " comes third with in a time of " << time3 << endl;
}
if (time3 > time1)
{
cout << string3 << " comes second with in a time of " << time3 << endl;
cout << string1 << " comes third with in a time of " << time1 << endl;
}
}
}
// Condition--3
if (time3 > time1)
{
if (time3 > time2)
{
cout << string3 << " comes first with in a time of " << time3 << endl;
if (time1 > time2)
{
cout << string1 << " comes second with in a time of " << time1 << endl;
cout << string2 << " comes third with in a time of " << time2 << endl;
}
if (time2 > time1)
{
cout << string2 << " comes second with in a time of " << time2 << endl;
cout << string1 << " comes third with in a time of " << time1 << endl;
}
}
}
}
else
{
cout << "invalid input: The Time of " << string3 << " is in negative" << endl;
cout << "Please enter the correct input!(Time is always in positive):" << endl;
}
}
else
{
cout << "invalid input: The Time of " << string2 << " is in negative" << endl;
cout << "Please enter the correct input!(Time is always in positive):" << endl;
}
}
else
{
cout << "invalid input: The Time of " << string1 << " is in negative" << endl;
cout << "Please enter the correct input!(Time is always in positive):" << endl;
}
return 0;
}
#include
#include
using namespace std;
int main()
{
float time_start;
float minutes;
cout << "_____________________________________________________" << endl;
cout << "-------------Long Distance Charge Carriers-----------" << endl;
cout << "_____________________________________________________" << endl;
cout << "Enter the started time of the call in the form HH.MM. as 07:45 :" << endl;
cin >> time_start;
// floating pointt get calculation
int x;
float y;
x = time_start;
y = time_start - x;
cout << setprecision(2) << fixed;
// Checkouts
if (time_start > 23.59)
{
cout << "Invalid:input." << endl;
}
else if (y > 0.59)
{
cout << "Invalid:input." << endl;
}
else
{
//Input minutes long call from the user
cout << "Enter the number of minutes the call long out:" << endl;
cin >> minutes;
//Check minutes validation
cout << setprecision(2) << fixed;
if (minutes - static_cast(minutes) > 0.59)
{
cout << "Invalid:Input." << endl;
}
else
{
//Packages range decisions
if (time_start >= 00.00)
{
if (time_start < 7.00)
{
cout << "Total call charges = $" << minutes * 0.05 << endl;
}
}
if (time_start >= 07.00)
{
if (time_start <= 19.00)
{
cout << "Total call charges = $" << minutes * 0.45 << endl;
}
}
if (time_start >= 19.01)
{
if (time_start <= 23.59)
{
cout << "Total call charges = $" << minutes * 0.20 << endl;
}
}
}
}
return 0;
}
#include
using namespace std;
int main()
{
char ch;
int minutes;
float extra_minutes;
float extra_cost;
float due_amount;
cout << "_____________________________________________________" << endl;
cout << "---------------Mobile Service Provider---------------" << endl;
cout << "_____________________________________________________" << endl;
cout << "Here are some packages for you:" << endl;
cout << "\tPackage A: For $39.99 per month 450 minutes are provided." << endl
<< "\tAdditional minutes are $0.45 per minute." << endl;
cout << endl;
cout << "\tPackage B: For $59.99 per month 900 minutes are provided." << endl
<< "\tAdditional minutes are $0.40 per minute." << endl;
cout << endl;
cout << "\tPackage C: For $69.99 per month unlimited minutes provided." << endl;
cout << endl;
cout << "Now choose any one of the package that you want to apply:" << endl;
cin >> ch;
if (ch == 'A' || ch == 'a')
{
cout << "Enter the minutes you used:" << endl;
cin >> minutes;
if (minutes > 450)
{
extra_minutes = minutes - 450;
extra_cost = extra_minutes * 0.45;
due_amount = 39.99 + extra_cost;
cout << "The due amount for the " << minutes << " minutes = $" << due_amount << endl;
}
else
{
cout << "The due amount for the " << minutes << " minutes = $39.99" << endl;
}
}
else if (ch == 'B' || ch == 'b')
{
cout << "Enter the minutes you used:" << endl;
cin >> minutes;
if (minutes > 900)
{
extra_minutes = minutes - 900;
extra_cost = extra_minutes * 0.40;
due_amount = 59.99 + extra_cost;
cout << "The due amount for the " << minutes << " minutes = $" << due_amount << endl;
}
else
{
cout << "The due amount for the " << minutes << " minutes = $59.99" << endl;
}
}
else if (ch == 'C' || ch == 'c')
{
cout << "You have provided the unlimited minutes :" << endl;
cout << "The due amount for the unlimited minutes = $69.99" << endl;
}
else
{
cout << "Invalid:input." << endl;
}
return 0;
}
#include
using namespace std;
int main()
{
int actual_value;
float assesment;
float tax;
cout << "_____________________________________________________" << endl;
cout << "---------------------Property Tax--------------------" << endl;
cout << "_____________________________________________________" << endl;
cout<<"Entered the actual value of a piece of a property:"<>actual_value;
//Calculations
assesment=actual_value*0.6;
tax=(assesment/100)*0.75;
//Display
cout<<"The assesment of the property = $"<
#include
#include
using namespace std;
int main()
{
int year,month,date;
int current_year,current_month,current_date;
int maximum_heartRate;
float target_heartRange;
int age;
cout << "_____________________________________________________" << endl;
cout << "-------------(Target-Heart-Rate Calculator)----------" << endl;
cout << "_____________________________________________________" << endl;
cout<<"Enter the year of your birth:"<>year;
cout<<"Enter the month of your birth:"<>month;
cout<<"Enter the date of your birth:"<>date;
cout<>current_year;
cout<<"Enter the current month:"<>current_month;
cout<<"Enter the current date:"<>current_date;
//Age calculate
if(current_month>=month && current_date>=date)
{
age=current_year-year;
cout<<"You are "<