In: Computer Science
Get information from the user Calculate Phone Line Charge Military Discount Display Phone Line Charge and Military Discount !!!!!
The user will need to input • Number of phone lines • Data plan chosen (U, M or L) U for Unlimited Data M for Moderate Data L for Limited Data • Military discount (Y or N) You can see examples of how to prompt the user for this information in the sample output windows below. Please note the number of phone lines can be an int, but the data plan and military discount need to use the char data type in order to store a U, M, L, Y or N. 2. Calculations (all these calculated variables should be double data type) • Phone Line Charge Unlimited data - $45 per phone line Moderate data - $25 per phone line Limited data - $15 per phone line • Discount (10% off phone line charge): if customer is an active or retired member of the military • Subtotal: Phone Line Charge - Discount • Surcharge and Taxes: 15% of Subtotal • Total: Subtotal + Surcharge and Taxes
phonelinecharge=subtotal=surcharge=total=0;
phonelines = int(input("Enter number of phonelines:"))
for i in range(phonelines):
print("\nEnter details for phoneline ",i+1);
plan = input("Enter data plan (U/M/L):");
military = input("Military discount (Y/N):");
if(plan=='U'):
phonelinecharge = 45;
elif(plan=='M'):
phonelinecharge = 25;
elif(plan=='L'):
phonelinecharge = 15;
if(military=='Y'):
subtotal = phonelinecharge - (phonelinecharge*0.10)
else:
subtotal = phonelinecharge
total = subtotal + (subtotal*0.15)
print("\n*****Details of phoneline {}*****".format(i+1))
print("Data plan:", plan)
print("Military:", military)
print("Total:$", total)
The above is the python code and the output is as follows, Make sure you provide inputs in all capital letters only