Question
In Python Constraints: Display any numerical output with 2 digits after the decimal point DO NOT use break and continue DO NOT use exit() to
In Python
Constraints:
Display any numerical output with 2 digits after the decimal point
DO NOT use break and continue
DO NOT use exit() to exit a program
Define a class named Sales that has the following attributes and methods:
A private variable to hold sales amount for quarter 1
A private variable to hold sales amount for quarter 2
A private variable to hold sales amount for quarter 3
A private variable to hold sales amount for quarter 4
A private variable for holding the total sales for the entire year
A private variable for holding the name of the company
A constructor to initialize the instance variables to some initial value of your choice
A public method that takes 4 parameters to set the sales for each quarter and the value for total sales. Note that total sales is the simple total of sales for each quarter
A member method to set a value for the name of the company
A member method to get/return the value of the total sales
A member method to get/return the sales amount for quarter 1
A member method to get/return the sales amount for quarter 2
A member method to get/return the sales amount for quarter 3
A member method to get/return the sales amount for quarter 4
A member method to get/return the name of the company
A member method to display the data. This is just a method with a bunch of output statements for all the instance variables. This method will display the company name, the sales amount for each quarter, and the total sales
Write a local method to return a valid number for amount of sales. A valid number is a number between 0 and $10,000.
In your main method:
1. Show how to create and display information for an object.
2. Ask the user to enter data for sales for 4 quarters and the company name. Make sure to validate the entered amount for sales. Create an object with this data (use the SETTER methods) and display the data using your method that displays the data.
3. Display ONLY the total sales amount for the object created in step 2. Note, you must use your GTETTER method to get this value to display its value.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started