1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IrinaK [193]
2 years ago
15

The Yuba College Library would like a program to calculate patron fines for overdue books. Fines are determined as follows: Pape

rbacks Regular $.20 / day with a maximum fine of $8.00 Best-Sellers $.50 / day with a maximum fine of $15.00 Magazines $.25 / day with a maximum fine of $5.00 Hardcover Books $.30 / day with a maximum fine of $23.00 The program must prompt the user to enter the following information at the keyboard. Data entry MUST be validated as required. Fines must also be calculated using a function(s). A class object should contain the methods (functions) to determine library fine. Provide a UML and description of disign.Patron’s library card number (a 4-digit number) - ValidatePatron’s namePatron’s addressType of book - ValidateNumber of days over due - ValidateA sample interactive session is shown below:Enter the patron’s card number: 2089Enter the patron’s name: Erica RobinsonEnter the patron’s address: 2234 RoadWay Trl.Enter the book’s title: The Trail Less Traveled.1. Paperback - Regular2. Paperback - Bestseller3. Magazine4. Hardcover bookEnter number corresponding to type of book (1 – 4): 4Enter the number of days overdue: 11Do you wish to perform another transaction?
Computers and Technology
1 answer:
mestny [16]2 years ago
5 0

Answer:

Explanation:

The following Python code creates all of the necessary functions in order to request and validate all of the inputs from the user. Once everything is entered and validated it calculates the total fee and outputs it to the user. Also calls the entire class at the end using a test variable...

class Customer:

   library_card = 0

   patrons_name = ""

   patrons_address = ""

   type_of_book = ""

   book_title = ""

   days_overdue = 0

   fee = 0.0

   book_list = ['paperback regular', 'paperback best seller', 'magazine', 'hardcover']

   def __init__(self):

       self.library_card = self.get_library_card()

       self.patrons_address = input("Patron's Address: ")

       self.book_title = input("Book Title: ")

       self.type_of_book = self.get_type_of_book()

       self.days_overdue = float(self.get_days_overdue())

       self.calculate_total()

       print("Your total Fee is: " + str(self.fee))

   def get_library_card(self):

       library_card = int(input("Enter 4-digit library card number: "))

       if (type(library_card) == type(0)) and (len(str(library_card)) == 4):

           return library_card

       else:

           print("Invalid Card number:")

           self.get_library_card()

   def get_type_of_book(self):

       type_of_book = input("Type of Book 1-4: ")

       if (int(type_of_book) > 0) and (int(type_of_book) <= 4):

           return int(type_of_book)

       else:

           print("Invalid Type")

           self.get_type_of_book()

   def get_days_overdue(self):

       days_overdue = input("Number of Days Overdue: ")

       if int(days_overdue) >= 0:

           return days_overdue

       else:

           print("Invalid number of days")

           self.get_days_overdue()

   def calculate_total(self):

       if self.type_of_book == 1:

           self.fee = 0.20 * self.days_overdue

           if self.fee > 8:

               self.fee = 8

       elif self.type_of_book == 2:

           self.fee = 0.50 * self.days_overdue

           if self.fee > 15:

               self.fee = 15

       elif self.type_of_book == 3:

           self.fee = 0.25 * self.days_overdue

           if self.fee > 5:

               self.fee = 5

       else:

           self.fee = 0.30 * self.days_overdue

           if self.fee > 23:

               self.fee = 23

test = Customer()

You might be interested in
The Universal Containers research lab is publishing its latest research into knowledge articles assigned to the data category "C
Olenka [21]

Answer:

Option C is correct.

Explanation:

The following research laboratory publishes their new work concerning articles of information allocated to the better standards container classification of information. The community manager needs to ensure all of those posts appear across the Tips and Methods subject field for Community users.

Thus, set up an automatic subject assignment and map the list of Tips and Techniques to the Container good practices group.

8 0
3 years ago
What is an example of constructive criticism for an employee who is shy during meetings?
rewona [7]
<span>Speak up more so people don't think you're rude</span>
8 0
3 years ago
Read 2 more answers
For your biology class, you have taken a number of measurements for a plant growth experiment. You wish to create a chart that s
Naya [18.7K]
Calc or Excel is the application best suited for this effort.
8 0
3 years ago
Read 2 more answers
The fundamental difference between a switch and a router is that a switch belongs only to its local network and a router belongs
Alla [95]

Answer:

The answer is True

Explanation:

Switches are responsible for connecting computers within a network and it belongs only to its local network. Its responsibility is to filter and forward packets between LAN segments. They operate on layer two (2) and sometime layer three (3) of the OSI Model.

Routers on the other hand, are responsible for the interconnections of two or more networks. They forward data packets between networks. They reside at gateways, exactly where two or more networks connects. And they use communication protocols to effectively and efficiently communicate among two or more host.

7 0
3 years ago
Howard is leading a project to commission a new information system that will be used by a federal government agency. He is worki
Ann [662]

Answer:

The correct answer is A.

Explanation:

Given the example in the question, Howard is at the step of implementing security controls.

There are five official steps for the risk management framework.

  1. Categorizing The Information System: In this step, the IT system's objectives are assigned based on the current mission or project.
  2. Selecting Security Controls: After the risk assesment is done, the security controls for technical, hardware and software problems are decided according to the outcome.
  3. Implementing Security Controls: In this step, the points that were decided in the step before are put into action.
  4. Authorizing The Information System: Authorization for the risk management is approved and monitored.
  5. Monitoring Security Controls: The authorities keep monitoring the process and makes any necessary changes and updates.

The process that is explained in the question is step 3, which is given in option A.

I hope this answer helps.

5 0
3 years ago
Other questions:
  • Katie created a web site that automatically scales to fit a cell phone. What kind of design did Katie use?
    12·2 answers
  • Which type of network cover a large geographical area and usually consists of several smaller networks, which might use differen
    5·1 answer
  • Which option marks all modification made within a document? Review Comment Track Changes Balloons
    15·2 answers
  • Why are application programs stored in main memory​
    11·1 answer
  • A film camera with only one lens is known as a(n)?
    11·1 answer
  • What happens to a message when it is deleted?
    11·1 answer
  • Mr. Simmons has assigned a research project. Every student in the class will create a single page report about the recycling hab
    15·1 answer
  • ) Perform error checking for the data point entries. If any of the following errors occurs, output the appropriate error message
    11·1 answer
  • Create a Python program that computes the cost of carpeting a room. Your program should prompt the user for the width and length
    10·1 answer
  • Select the correct answer from each drop-down menu. A company is recruiting for a web designer. What kind of candidate should th
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!