Question

In: Computer Science

Get information from the user Calculate Phone Line Charge Military Discount Display Phone Line Charge and...

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

Solutions

Expert Solution

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


Related Solutions

Using the given file, ask the user for a name, phone number, and email. Display the...
Using the given file, ask the user for a name, phone number, and email. Display the required information. These are the Files that I made: import java.util.Scanner; public class Demo5 { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); System.out.println("New number creation tool"); System.out.println("Enter name"); String name = keyboard.nextLine(); System.out.println("Enter phone number"); String phoneNumber = keyboard.nextLine(); System.out.println("Enter email"); String email = keyboard.nextLine(); Phone test1 = new SmartPhone(name, phoneNumber, email); System.out.print(test1); System.out.println("Telephone neighbor: " + ((SmartPhone) test1).getTeleponeNeighbor()); }...
Allow the user to enter the number of people in the party. Calculate and display the...
Allow the user to enter the number of people in the party. Calculate and display the amount owed by each person if the bill were to be split evenly among the party members. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mdc.tippcalcula"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> ------------------------------- <?xml version="1.0" encoding="utf-8"?> <GridLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:columnCount="2" android:useDefaultMargins="true" tools:context=".MainActivity"> <EditText android:id="@+id/amountEditText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10" android:hint="" android:digits="0123456789" android:inputType="number"...
• 2. Get all the information from the user using methods Java • B. if the...
• 2. Get all the information from the user using methods Java • B. if the inputs are not given in the proper format the program should prompt user to give the proper input (eg. Name cannot be numbers, age cannot be String)
Write the program in Java (with a graphical user interface) and have it calculate and display...
Write the program in Java (with a graphical user interface) and have it calculate and display the mortgage payment amount from user input of the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage. Allow the user to loop back and enter new data or quit. You need to include Calculate, Reset, and Exit buttons on your GUI. Please insert comments in the program to document the program. Allow the user to enter...
(1) In this problem, we will calculate the electric ?eld of a line charge. The line...
(1) In this problem, we will calculate the electric ?eld of a line charge. The line charge is aligned along the x-axis starting at the origin and having a length L. The line has a linear charge density ?. We want to ?nd the electric ?eld at a point P on the x-axis. The point P is located at the point pd,0q where d?L. (a) List all of the given parameters. (b) What is the dimensionality of a line of...
Get all homework scores for one student, calculate and display the sum of the scores, and...
Get all homework scores for one student, calculate and display the sum of the scores, and also display the word “fail” if the sum is lower than 150. Note: we do not know how many homework scores each student will enter. Ask the user how many homework scores there are at the beginning. Then, ask for a homework score at a time, for as many times as indicated by the user. C++
Write a program to use Math methods to calculate and display the followings: Prompts the user...
Write a program to use Math methods to calculate and display the followings: Prompts the user to enter an angle, in degrees, and then display the angle in radians and the Sine of the angle. Prompts the user to enter a positive integer and calculates the square root of the number. Computational thinking: Your program must check if it is a positive number. If a negative number is entered, it must ask for another number until the positive number is...
First, the Python program prompts user to enter user information (name, email, and phone number). Then...
First, the Python program prompts user to enter user information (name, email, and phone number). Then it displays a menu called “Fish Information” that has the following fish type: 1. Cat Fish 2. Red Fish 3. Any other fish Let user choose the fish type that he/she got and input the length of the fish. Then the program will determine what should be done with this particular fish. Based on the following criteria: Criteria: Length: FISHTYPE - Cat Fish <10:...
Calculate Beta for Apple and Microsoft, using a characteristic line. Display the data points on a...
Calculate Beta for Apple and Microsoft, using a characteristic line. Display the data points on a graph and display the characteristic line. Yearly Returns Microsoft Apple Market Jan 2010 - Dec 2010 Year. 1 -0.34% 5.18% 14.93% Jan 2011 - Dec 2011 Year. 2 -0.37% 7.93% 2.06% Jan 2012 - Dec 2012 Year. 3 0.40% 5.15% 15.84% Jan 2013 - Dec 2013 Year 4 2.81% 5.99% 32.21% Jan 2014 - Dec 2014 Year. 5 1.91% 4.62% 13.53% Jan 2015 -...
Calculate Beta for Apple and Microsoft, using a characteristic line. Display the data points on a...
Calculate Beta for Apple and Microsoft, using a characteristic line. Display the data points on a graph and display the characteristic line. Year Microsoft Apple Market Jan 2010 - Dec 2010 1 -0.34% 3.85% 14.93% Jan 2011 - Dec 2011 2 -0.37% 2.09% 2.06% Jan 2012 - Dec 2012 3 0.40% 2.87% 15.84% Jan 2013 - Dec 2013 4 2.81% 0.38% 32.21% Jan 2014 - Dec 2014 5 1.91% 3.05% 13.53% Jan 2015 - Dec 2015 6 1.75% -0.45% 1.34%...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT