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
What are the answers to everfi
FinnZ [79.3K]
FutureSmart focuses on the important Middle School years by empowering students to become the stewards of their financial futures. This three hour web-based resource educates students on the practicalities of daily financial decisions and the payoffs of long-term planning. Since Middle School is an important period for positive habits
to take form and grow, this course is particularly meaningful.
Through a compelling narrative in which students play the Mayor of a town, local citizens are helped with real-life decisions. From weighing opportunity costs, to delaying instant gratification for long- term gain, students face important questions on their way to becoming FutureSmart. At the end of the course, students compose their own blueprint for the future. FutureSmart c
6 0
3 years ago
What is a distraction that you find when photographing animals at the zoo
yaroslaw [1]

D. All of the above.

<u>Reason:</u>

A. Fences can get in the way of a beautiful picture.

B: The animal's enclosure may be hard to get the perfect snap. Like a rock can be in the way of the animal. idk...lol

C. People want to see the animal as much as you do so they may block the way of a picture.

Example from Google..XD


7 0
3 years ago
To steal credit card information by installing devices on card readers located in ATMs, gas pumps, restaurants, grocery stores,
riadik2000 [5.3K]

Answer:

Skimming

Explanation:

7 0
3 years ago
Read 2 more answers
Thanks to ____ files, a website can recognize you and cater to your individual tastes each time you visit.
Licemer1 [7]
Saved files now and days
4 0
3 years ago
It is ok to sell services on Xbox in exchange for real-world money
Sati [7]
Is this a true or false question? If it is let me know and I can help! (:
6 0
3 years ago
Read 2 more answers
Other questions:
  • Acrynom for wys or wyg
    10·1 answer
  • Write a method swaparrayends() that swaps the first and last elements of its array parameter. ex: sortarray = {10, 20, 30, 40} b
    15·1 answer
  • What is an IP address and where I can find the IP address for my computer?
    14·1 answer
  • Write the definition of a method, oddsMatchEvens, whose two parameters are arrays of integers of equal size. The size of each ar
    10·1 answer
  • What was the process called that required the photographer to have a tent or darkroom handy so that chemicals could be mixed qui
    7·1 answer
  • Is USA TestPrep a test-taking site that won't let you access other windows without kicking you off?
    13·1 answer
  • Differentiate between trusted-source-security and antispoofing-security techniques.
    10·1 answer
  • Write a program to read 10 integers from an input file and output the average, minimum, and maximum of those numbers to an outpu
    14·1 answer
  • How do you reflect yourself in the topic (filters)​
    14·1 answer
  • Which of the following statements best illustrates how value was created for eggs? when a farmer sells a chicken who is no longe
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!