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
Privacy Group of answer choices must be respected if we are to function as complete, self-governing agents is an absolute value
ElenaW [278]
Privacy group in article 3 in constitution section 3 too
8 0
2 years ago
Write a c++ program to calculate the approximate value of pi using this series. The program takes an input n that determines the
Tanya [424]

Answer:

#include <iostream>

#include <iomanip>

using namespace std;

int main() {

  char choice;

  cout << setprecision(12) << endl;

  while(true) {

      int sign = 1;

      double pi = 0;

      cout << "Enter number of terms: ";

      long n;

      cin >> n;

      for(long i = 1; i < n; i += 2) {

          pi += sign/(double)i;

          sign = -sign;

      }

      pi *= 4;

      cout << "value of pi for n = " << n << " is " << pi << endl;

      cout << "Do you want to try again(y or n)? ";

      cin >> choice;

      if(choice == 'n' || choice == 'N') {

          break;

      }

  }

  return 0;

}

Explanation:

6 0
2 years ago
PLSSSSS HELPP!! Population biologists are concerned about invasive species such as the zebra mussel found in North American wate
elixir [45]

Answer: A.The introduced species compete for resources more effectively than native species.

Explanation:

An introduced species is also called the exotic species and this is an organism which is not a native organism or specie and therefore isn't native to the place but rather it's being transported to the place through the activities of human being.

When the introduced species are introduced to a particular area, they compete with the natives for the available resources and often do this more effectively than the other native species.

Therefore, the correct option is A.

4 0
3 years ago
What is the internet?
aliya0001 [1]
What you're currently on. or a global computer network providing a variety of information and communication facilities, consisting of interconnected networks using standardized communication protocols.
7 0
3 years ago
Read 2 more answers
Select the correct answer from each drop-down menu. Rita runs a small business that designs custom furnishings for corporate cli
LUCKY_DIMON [66]

Software as a Service cloud model is ideal for Rita’s business. SaaS are office solutions that allow Rita’s small business to work more efficiently and in a more organized way. Most SaaS applications are used for invoicing and accounting, sales, performance monitoring, and overall planning. SaaS applications can save Rita money. They do not require the deployment of a large infrastructure at her location. As a result, it drastically reduces the upfront commitment of resources. Whoever manages SaaS’s IT infrastructure running the applications brings down fees for software and hardware maintenance. SaaS has generally been acknowledged to be safer than most on-premise software.

5 0
3 years ago
Read 2 more answers
Other questions:
  • 4. Discuss the advantages and disadvantages of using the same system call interface for both files and devices. Why do you think
    5·1 answer
  • The essence of strategy is ____, so competitive advantage is often gained when an organization tries a strategy that no one has
    15·1 answer
  • What can use so tha the slides can appear?
    13·1 answer
  • What is a Photojournalist
    5·1 answer
  • nswer the following questions concerning chapter 1:1.1 Which pair of layers are NOT peer layers?a.Transport layer in the sender
    9·1 answer
  • Which of the following will you select as X in the following series of clicks to lay the title over a chart: Chart Title box &gt
    14·1 answer
  • How does a router differ from such devices as repeaters, bridges, and switches?
    6·1 answer
  • An mp3 takes up about 16 kilobytes of memory per second of music. if you owned a one terabyte hard drive and filled it with only
    15·1 answer
  • An optical fibre has an attenuation of 0.3 dB/km. If a laser launches an optical power level of PIN (mW) into 35 km length of th
    8·1 answer
  • What option can be used by a system administrator to ensure that dynamic updates are made only by known clients when you have a
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!