
def intValueCheck(strData):
intData = 0
while True:
try:
intData = int(strData)
except ValueError:
print('\t\tThe data entered was not an integer numeric value.. please re-renter...')
strData = input('\t\tRe-enter the data as a integer value: ')
else:
break
return intData
def processLoop(remainingYears,current_year,startingSalary, salaryIncrease):
netTotal = 0
yearsWorked = 1
for i in range(remainingYears):
startingSalary = (startingSalary * salaryIncrease) + startingSalary
yearsWorked = yearsWorked + 1
current_year = current_year + 1
netTotal = netTotal + startingSalary
print(yearsWorked, "\t\t", current_year, "\t $", startingSalary)
return netTotal
def main():
#Display Program Purpose
print("The program will show how much money you will make working a job that gives a inputted percentage increase each year")
#Declaration and Initialization of Variables
userName = "" #Variable to hold user's name
currentYear = 0 #Variable to hold current year input
birthYear = 0 #Variable to hold birth year input
startingSalary = 0 #Variable to hold starting salary input
retirementAge = 0 #Variable to hold retirement age input
remainingYears = 0 #Variable to hold years left to work
salaryIncrease = 0 #Variable to hold increase in yearly salary
i = 0 #Variable i
newSalary = 0 #Variable to hold new salary input
yearsWorked = 0 #Variable to hold years spent working input
netTotal = 0 #Variable to hold total money earned
#Prompt user to input name
userName = input("Please enter your first name: ")
#Prompt user to input the current year
currentYear = intValueCheck(input("Please enter the current year (xxxx): "))
#Prompt user to input birth year
birthYear = intValueCheck(input("Please enter your birth year (xxxx): "))
#Prompt user to input starting salary
startingSalary = intValueCheck(input("Please enter your starting salary(xxxxx): $"))
#Prompt user to input salary increase
salaryIncrease = float(input("Please enter the increase you expect (.xx): "))
#Prompt user to input expected retirement age
while(retirementAge != 62 and retirementAge != 67 and retirementAge != 70):
retirementAge = intValueCheck(input("Please enter your expected retirement age (62, 67, or 70): "))
#Calculate value of remainingYears variable
remainingYears = retirementAge - (currentYear - birthYear)
#Reinitialize yearsWorked variable to 1
yearsWorked = 1
#Display calculations for first year of work
print(userName, "Estimated remaining years to work: ", remainingYears)
print("Years Worked\tYear\tSalary")
print(yearsWorked, "\t\t", currentYear, "\t", "$", round(startingSalary))
#Calculate salary for each year using for loop logic
netTotal =processLoop(remainingYears,currentYear,startingSalary,salaryIncrease)
#Display solution of total money earned over lifetime
print("Total net earnings: $", round(netTotal))
main()
Code Screenshot:


Output:


using this code to complete. it python 3.#Display Program Purpose print("The program will show how much...
Using python, write code for problem. Please also put screenshot
of your code.
The following program will perform properly if the user enters 0 in response to the request for input. However, the program will crash if the user responds with "eight". Rewrite the program using a try/except statement so that it will handle both types of responses. See Fig. 6.1. while True: n = int (input ("Enter a nonzero integer: ")) if n! = 0: reciprocal = 1/n print...
Swapping Values in python Summary In this lab, you complete a Python program that swaps values stored in three variables and determines maximum and minimum values. The Python file provided for this lab contains the necessary input and output statements. You want to end up with the smallest value stored in the variable named first and the largest value stored in the variable named third. You need to write the statements that compare the values and swap them if appropriate....
This is for a java program public class Calculation { public static void main(String[] args) { int num; // the number to calculate the sum of squares double x; // the variable of height double v; // the variable of velocity double t; // the variable of time System.out.println("**************************"); System.out.println(" Task 1: Sum of Squares"); System.out.println("**************************"); //Step 1: Create a Scanner object //Task 1. Write your code here //Print the prompt and ask the user to enter an...
Write a PYTHON program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the...
In this assignment you are asked to write a Python program to determine all the prime numbers in between a range and store them in a list that will be printed when the range is searched. The user is prompted for two positive integer values as input, one is the start of the range and the other is the end of the range. If the user gives a negative value or enters a second number that is lower than the...
package _solution;
/**
This program demonstrates how numeric types and operators behave in Java
Do Task #1 before adding Task#2 where indicated.
*/
public class NumericTypesOriginal {
public static void main (String [] args) {
//TASK #2 Create a Scanner object here
//identifier declarations
final int NUMBER = 2 ; // number of scores
int score1 = 100; // first test score
int score2 = 95; // second test score
final int BOILING_IN_F = 212; // boiling temperature
double fToC;...
Write a Java program to convert octal (integer) numbers into their decimal number equivalents (exactly the opposite of what you have done in Assignment 4). Make sure that you create a new Project and Java class file for this assignment. Your file should be named “Main.java”. You can read about octal-to-decimal number conversions on wikepedia Assignment 4 is at the bottom Objective Your program should prompt the user to enter a number of no greater than 8 digits. If the...
in c++ language 1.Re-write the following for loop statement by using a while loop statement: int sum = 0; for(int i=0;i<=1000;i++){ sum+=i; } 1 (b). Following is the main () function of a program. The program asks a user to enter 150 integers and print the largest integer user entered. int main() { int score, highest; //missing portion of the program return 0; } 1(c). Find the missing portion of the following code, so the...
I need to create a code for this prompt: In this project we will build a generic UserInput class for getting keyboard input from the user. Implementation: The class UserInput is a 'Methods only' class, and all the methods should be declared static. Look at the TestScanner.java program at the bottom of this page that inputs a string, int and double. It shows you how to use Scanner class to get input from the keyboard. Write FOUR simple methods, one...
C++ program Correctly complete the following assignment. Follow all directions. The main purpose is to show super and sub class relationships with an array of super media pointers to sub class objects and dynamic binding. The < operator will be overloaded in the super class so all subclasses can use it. The selection sort method will be in the main .cpp file because it will sort the array created in main. The final .cpp file, the three .h header class...