question archive Build Bold is a small builder in Australia that focus on building sheds and villas in rural areas

Build Bold is a small builder in Australia that focus on building sheds and villas in rural areas

Subject:Computer SciencePrice:5.87 Bought7

Build Bold is a small builder in Australia that focus on building sheds and villas in rural areas. They are willing to develop a small software to manage their  employees, customers, and services. They have made this decision to reduce their operational cost, have a better understanding of their customer base,  and improve the quality of their services. They think that these can be achieved by an automated system to store and retrieve the details of employees, customers, services, and inspection bookings. Before the company invests on the final product, the have agreed on developing a  proof?of?concept first. The idea is that your solution will 'prove' that a better solution is possible. From your solution, it is hoped that the requirements  from Build Bold can be extracted and a full software development project can be started. 

Your proof?of?concept should include at least the following functional requirements:  

_The user adds a new employee  

_The user adds a new customer 

_The user adds a new property 

_The user adds a new inspection booking  

_The user assigns a customer and a property to a booking  

_The user prints the list of all bookings 

_The user prints the list of all customers  

_The user prints the list of all properties 

The functional requirements, if proved by your solution, will be supplemented by non?functional requirements in the subsequent requirements gathering exercise. Some of these may be the presentation of options in a graphical l user interface, printed reports on letterheads, security or other options that do not matter for the present proof of concept.

In presenting your solution, it is expected that it will compile and run. You should give the user series of options to choose from, if they are interact with your program. For example, choosing option '1' may be the route the user will take to enter a new employee. Choosing option '2' may be the route to allowing the user to add a new customer and so on. 

Hints:

_Before you start programming, you have to identify the main classes that you need to define since you will be using the Object-Oriented Programming (OOP) principles and best practices to develop the proof?of?concept.  

_You will need a minimum of four classes and can use variables and arrays to store data.  

_You do not need to store ay of data in files since this will be implemented after the approval of the proof-of-concept.  

_? Your main class or function will be the one that allows you to showcase the capabilities of the proof?of?concept. As discussed above, the user should be allowed to have a menu to choose the options.  

 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Answer:
class Employee:
    def __init__(self, empId, empName, empDep):
        self.empId = empId
        self.empName = empName
        self.empDep = empDep

class Customer:
    def __init__(self, custId, custName):
        self.custId = custId
        self.custName = custName

class Property:
    def __init__(self, propId, propName, propType, propLoc):
        self.propId = propId
        self.propName = propName
        self.propType = propType
        self.propLoc = propLoc
        self.isBooked = False
        

class InspectionBook:
    def __init__(self, bookId, customerBooked, propertyBooked):
        self.bookId = bookId
        self.customerBooked = customerBooked
        self.propertyBooked = propertyBooked

class BuildBold:
    def __init__(self):
        self.customerList = []
        self.employeeList = []
        self.inspectionList = []
        self.propertyList = []

    def addCustomer(self, c):
        self.customerList.append(c)
    
    def addProperty(self, p):
        self.propertyList.append(p)

    def addEmployee(self, e):
        self.employeeList.append(e)
    
    def addBooking(self, b):
        self.inspectionList.append(b)

    def printCustomers(self):
        print("Details of Customers")
        for i in self.customerList:
            print("CustomerId: {}, CustomerName: {}".format(i.custId, i.custName))

            
    def printBooking(self):
        for i in self.inspectionList:
            print("BookingId: {}, Customer Booked: {}, Property Booked:{}".format(i.bookId, i.customerBooked.custName, i.propertyBooked.propName))

    def printProperty(self):
        for i in self.propertyList:
            print("PropertyId: {}, PropertyName: {}, PropertyType: {}, PropertyLocation: {}, Is Booked: {}".format(i.propId, i.propName, i.propType, i.propLoc, i.isBooked))

    def findCustomer(self, id):
        for i in self.customerList:
            if i.custId==id:
                return i
        return None
    
    def findProperty(self, id):
        for i in self.propertyList:
            if i.propId==id:
            	if i.isBooked==True:
            		return None
                return i
        return None

build = BuildBold()
while True:
    print("""
    Select an option from the menu:
    1. Add a new employee
    2. Add a new customer
    3. Add a new property
    4. Add a new Booking
    5. Display the details of customers
    6. Display the details of properties
    7. Display the details of booking
    8. Exit
    """)
    ans = int(input())
    if ans==1:
        print("Enter the Employee Id: ")
        id = int(input())
        print("Enter Employee Name: ")
        name = input()
        print("Enter Employee Department")
        dep = input()
        e = Employee(id, name, dep)
        build.addEmployee(e)
    elif ans == 2:
        print("Enter Customer Id: ")
        id = int(input())
        print("Enter Customer Name: ")
        name = input()
        c = Customer(id, name)
        build.addCustomer(c)
    elif ans == 3:
        print("Enter the Property Id: ")
        id = int(input())
        print("Enter Property Name: ")
        name = input()
        print("Enter Property Type: ")
        type = input()
        print("Enter Property Location: ")
        loc = input()
        p = Property(id, name, type, loc)
        build.addProperty(p)
        
    elif ans == 4:
        print("Enter the Id of the Customer")
        custId = int(input())
        print("Enter the Id of the Property")
        propId = int(input())
        print("Enter the Booking id")
        bookId = int(input())
        c, p = build.findCustomer(custId), build.findProperty(propId)
        if c and p:
            i = InspectionBook(bookId, c, p)
            build.addBooking(i)
            p.isBooked = True
        else:
            print("Invalid Details")

    elif ans==5:
        
        build.printCustomers()
    elif ans == 6:
        build.printProperty()
    elif ans==7:
        build.printBooking()
    else:
        print("Thank You!")
        break

Step-by-step explanation

Initially, we have 5 classes.

Class Employee stores the employee details such as employee id, employee name and employee department.

Class Customer stores the Customer details such as customer id and name.

Class Property stores the Property Details. Here, isBooked is a boolean variable which shows whether the property is previously booked by another customer. It is assumed that a particular property can be booked by only one customer.

Class InspectionBook contains the booking details. customerBooked is an object of the class Customer and propertyBooked is an object of the class Property.

Class BuildBold is our main class which holds the details of other classes. List containing employee details, customer details, property details and booking details are initially empty.

First we display the menu to choose option. User enters their choice. Based on the choice, the following actions will be performed.

if input is 1, user can enter the employee details. Subsequently, the employee list of the build class is updated.

if input is 2, user can enter the customer details. Subsequently, the customer list of the build class is updated.

if input is 3, user can enter the property details. Subsequently, the property list of the build class is updated.

if input is 4, user can enter the booking details

First we check if the customer id is valid. If the customer exists, the corresponding customer object is returned. If not, None object is returned. 

Then we check if the property id is valid. If yes, we ill check whether the property had been booked by any other customer. If not, we will return the corresponding property object. Else None is returned. 

If values of both customer object and property object is not None, then we update the Booking List. We will set the isBooked value of Property object to be True. If any of the values are None, then we print("Invalid Details").

if input is 5, 6 or 7, the customer details, property details or booking details are displayed respectively.

If input is 8, we can exit the program.

Related Questions