Question

I need help constructing a special inventory system. I need certain components that will check the...

I need help constructing a special inventory system. I need certain components that will check the age of the customer and then assign them to a car model.

It will be business logic classes. To test your classes, you will use them in a relatively small test application.

The requirements for testing and the classes within PYTHON 3 are as follows:

• Need to build and design TWO components of the reservation sys.

One class to represent customers, and another to represent vehicles with AT LEAST 2 METHODS IN EACH OF THE TWO CLASSES.

Again, the reservation system will also need to verify if the customer is at least twenty-five years of age, if they are of age the process can continue and car assigned.. Otherwise, the user should be notified that they are not allowed to rent the car with a prompt stating sorry they are under twenty-five years of age.

• If the customer is 25+, the components should assign the client a car

• The following will each need to be inputted in each of the two classes:  

For the customer class: CustomerID, Name, DOB (to determine eligibility), phone number, and vehicle assigned.

For the vehicle class:  VIN Number, Make, Model, and model year.

I just need a small application for testing purposes. The console input should be used to GATHER ALL INFORMATION about customer data.

The information you need about the vehicle can be hard coded with the init constructor or you can also set methods of the Vehicle class.

When complete the small application should include the following – adaptation with instances of your classes,  Asking the user for all the required information, while confirming if the user meets the 25+ requirement.

If this age requirement is met the client is assigned a vehicle.

There should be an OUTPUT VEHICLE confirmation to the screen, showing: CustomerID, Name, Vehicle VIN, Make, and the Model assigned..

That is all!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Short Summary:

·       Created Customer and Vehicle class.

·       Used __str__ methods to print the details

·       Constructor of Customer class assigns a vehicle, if customer age is 25+.

·       Hard coded the vehicle information in the constructor of Vehicle class.

Source Code:

from datetime import datetime

#Customer class

class Customer:

    #constructor

   def __init__(self, id, name, dob, phone):

      self.__id = id

      self.__name = name

      # Convert the string into datetime

      self.__dob = datetime.strptime(dob, '%m/%d/%Y')

      self.__phone = phone

     

      # if age is 25+, assign a vehicle

      if self.__getAge() > 25:

        self.__vehicle = Vehicle()

      else:

        self.__vehicle = None

       

    #Override tostring method to return the attributes values

   def __str__(self):

       # if vehicle is assigned

       if self.__vehicle is not None:

           return ("Customer ID: " + str(self.__id) + "\nCustomer Name: " + self.__name + "\nVehicle: " + str(self.__vehicle))

       else:

           return ("Customer ID: " + str(self.__id) + "\nCustomer Name: " + self.__name + "\nVehicle: "

                   + "Sorry you are under 25; not allowed to rent a car")

  

   # private method to calculate age

   def __getAge(self):

        today = datetime.today()

        return int((today - self.__dob).days / 365.25);

          

#Vehicle class

class Vehicle:

    #constructor

   def __init__(self):

      self.__vin = 12345678

      self.__make = "Honda"

      self.__model = "Civic"

      self.__year = 2018

   

    #Override tostring method to return the attributes values

   def __str__(self):

       return ("Vin number: " + str(self.__vin) + ", Make: " + str(self.__make) + ", Model: "

               + str(self.__model) + ", Year: " + str(self.__year))

   

# Main method gets user inputs and does the reservation

def doReservation():

    custId = input("Enter customer id: ")

    name = input("Enter customer name: ")

    dob = input("Enter customer date of birth(MM/DD/YYYY): ")

    phone = input("Enter customer phone number: ")

   

    # Create customer class

    customer = Customer(custId, name, dob, phone)

    print("Reservation Result: ")

    # print the information

    print(customer)

if __name__ == "__main__":

    # Call main method to start the program

    doReservation()

   

Refer the following screenshots for code indentations:

Reservation.py i from datetime import datetime Customer class class Customer: Constructor def __init__(self, id, name, dob, p

Sample Run 1:

Shell Python 3.7.6 (bundled) >>> %Run Reservation.py Enter customer id: 100 Enter customer name: SaraDurs Enter customer date

Sample Run 2:

Shell >>> %Run Reservation.py Enter customer id: 101 Enter customer name: Kevin Enter customer date of birth (MM/DD/YYYY): 8/

******************************************************************************

Feel free to rate the answer and comment your questions, if you have any.

Please upvote the answer and appreciate our time.

Happy Studying!!!

******************************************************************************

Add a comment
Know the answer?
Add Answer to:
I need help constructing a special inventory system. I need certain components that will check the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • SYSTEM ANALYSIS AND DESIGN CLASS ... ( HELP PLEASE I NEED THIS NOW......I WILL RATE!!!!) Chapter...

    SYSTEM ANALYSIS AND DESIGN CLASS ... ( HELP PLEASE I NEED THIS NOW......I WILL RATE!!!!) Chapter 8 Homework (DIAGRAMS NEEDED) PLEASE!!! Scenario: Sweetbriar College is redesigning their course registration system [CRS]. They plan for this system to be web-based, but first you need to model the main system behind the web interface. Here is a description of the interactions with the proposed CRS. Faculty enter courses into the system, assign section numbers, instructors, dates, times, and classrooms for individual instances...

  • A small airline has just purchased a computer for its new automated reservations system

    OBJECTIVE:The objective of the assignment is to use object-oriented design techniques to design an application.DESCRIPTION:A small airline has just purchased a computer for its new automated reservations system. You have been hired to design an airline seating application for the FBN (Fly-By-Night) Airlines. In this portion of the assignment, the task is to do the object oriented design for the application. This system will be used only by the company and its employees. Customers will not interact with the system.Your...

  • Assignment Requirements I have also attached a Class Diagram that describes the hierarchy of the inheritance...

    Assignment Requirements I have also attached a Class Diagram that describes the hierarchy of the inheritance and interface behaviors . The link to the PDF of the diagram is below MotorVehical.pdf Minimize File Preview User Define Object Assignment: Create a Intellij Project. The Intellij project will contain three user defined classes. The project will test two of the User Define Classes by using the invoking each of their methods and printing the results. You are required to create three UML...

  • 10q I need help this is a python language For the following question, refer to the...

    10q I need help this is a python language For the following question, refer to the Python module on the right, as well as the name of the file that contains each module. 1) What is the output of the following code?. import animals alist = [animals.cat('Garfield'), animals.Dog('odie'), animals. Fox ('Nicholas P. wilde'), animals. Animal ('Judy Hopps')] File animals.py class Animal: def _init__(self, name): self.name = name def getName(self): return self.name for a in alist: print( a.getName() + ', '...

  • I need some help i need to do this in C# Objectives: • Create an application...

    I need some help i need to do this in C# Objectives: • Create an application that uses a dictionary collection to store information about an object. • Understanding of abstract classes and how to use them • Utilize override with an abstract class • Understanding of Interfaces and how to use them • Implement an Interface to create a “contract” between classes. • Compare and contrast inheritance and interfaces. Instructions: Interface: Create an interface called ITrainable which contains the...

  • I need this in java please Create an automobile class that will be used by a...

    I need this in java please Create an automobile class that will be used by a dealership as a vehicle inventory program. The following attributes should be present in your automobile class: private string make private string model private string color private int year private int mileage. Your program should have appropriate methods such as: default constructor parameterized constructor add a new vehicle method list vehicle information (return string array) remove a vehicle method update vehicle attributes method. All methods...

  • I could really use some help with this question! Thanks!! Must use C# and it must...

    I could really use some help with this question! Thanks!! Must use C# and it must be a console application ------------------------------------------------------------------------------------------------------------------------------ You start working on this w/o arrays just with seats: bool f1, f2,..., e1, e2,.... You can use Console application for now. A small airline has just purchased a computer for its new automated reservations system. You have been asked to develop the new system. You’re to write an app to assign seats on each flight of the airline’s...

  • I need help writing my main method**** Computer Science 111 Introduction to Algorithms and Programming: Java...

    I need help writing my main method**** Computer Science 111 Introduction to Algorithms and Programming: Java Programming Project #4 – Classes and Objects (20 Points) You will create 3 new classes for this project, two will be chosen from the list below and one will be an entirely new class you invent.Here is the list: Shirt Shoe Wine Book Song Bicycle VideoGame Plant Car FootBall Boat Computer WebSite Movie Beer Pants TVShow MotorCycle Design First Create three (3) UML diagrams...

  • Python 3 Problem: I hope you can help with this please answer the problem using python...

    Python 3 Problem: I hope you can help with this please answer the problem using python 3. Thanks! Code the program below . The program must contain and use a main function that is called inside of: If __name__ == “__main__”: Create the abstract base class Vehicle with the following attributes: Variables Methods Manufacturer Model Wheels TypeOfVehicle Seats printDetails() - ABC checkInfo(**kwargs) The methods with ABC next to them should be abstracted and overloaded in the child class Create three...

  • Final Project: Part I For Part I of your final project, you will design your plan for the scenari...

    Final Project: Part I For Part I of your final project, you will design your plan for the scenario provided below. Your project plan should include the entity relationship diagram (ERD). Scenario Imagine that you just started a new job at ABC Car Sales. You’ve been given the task of adding all the new and used car inventory to a new database management system (DBMS). You would like to manage the new and used car sales in the new DBMS....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT