Sample Assignment Assignment 10 Name: ___________________________ CSC-1110 Section: ______ Assignment 10 COMPLETE THE HONOR CODE BELOW HONOR CODE: I pledge that this program represents my own program...

1 answer below »
python assignment


Sample Assignment Assignment 10 Name: ___________________________ CSC-1110 Section: ______ Assignment 10 COMPLETE THE HONOR CODE BELOW HONOR CODE: I pledge that this program represents my own program code, I have received help from no one and I have given help to no one. OR I received help from NAME OR NO ONE in designing and debugging my program. I have given help to NAME OR NO ONE in designing and debugging my program. This assignment is required. The grading form shows point values for this assignment. Please review it now. Show screen shots of the python code with comments and your input/output window. You should use several well-planned sets of data to check out your program. Testing your programs with just the data that is asked for in the assignment does not necessarily mean that the programs will work for all cases. Please include the following comments in each of your Python programs: Your Name Section Date Description Assignment Number A python template (python_template.py) has been provided for you to use. Name this document XXX_Assignment 10 where XXX are your initials. Include a python file named P01.py, P02.py, etc. for each problem. 1. Write a class called Chair. This Chair class should have the following fields: · _ _id: This is the unique id of the chair. · _ _make: This the make of the chair · _ _model: This is the model of the chair · _ _color: this is the color of the chair · _ _no_legs: this is the numbers of legs the chair has. NOTE: if the value is less than 2 raise ValueError. · _ _rollers: this is a boolean (not yes and no) field the determines if the legs have rollers Add the following methods: · __str__: This is the print method that will print the following information: · get_id: This method returns the value of the id field. · get_make: This method returns the make · get_model: This method returns the model · get_color: This method returns the color · get_no_legs: This method returns the number of legs · get_rollers: This method returns yes if the chair has wheels or no if it does not · set_id: This method sets the value of the id field. · set_make: This method sets the make · set_model: This method sets the model · set_color: This method sets the color · set_no_legs: This method sets the number of legs. NOTE: if the value is less than 2 raise ValueError. · set_rollers: This method accepts a Yes or Y & No or N values. The case does not matter. Therefore, yes or YES should be treated as the same. If Yes sets the rollers field to true or false if not. If any other value is received raise ValueError. PLACE SCREEN SHOTS OF THE STUDENT CLASS CODE BELOW. 2. Write a program that opens the chair_inventory.txt file. HINT: Remember to use rstrip(‘\r\n’) when getting each line from the file. The file contains information for an unknown number of records. All values are separated by a comma. The values in each row are as follows id, make, model, color, number of legs, and rollers for each chair object. Your program should split each row and create a chair object from each row. Your program will use the __str__ of the Chair class to output the result for each chair in the file. The program will keep track of each line that had an error and will report at the end. The output of your program should look like the following: Chair ID: 14587 Make: Steelcase Model: Gesture Chair Color: Brown No of Legs: 3 Rollers: No Chair ID: 14587 Make: Herman Miller Model: Cosm Chair Color: Brown No of Legs: 4 Rollers: No The following rows had errors: XX, XX, XX PLACE SCREEN SHOTS OF THE STUDENT CLASS CODE BELOW. id,make,model,color,number of legs,rollers? 58979,Todd,Karla Chair,Black,4,Y 19782,Winona,Glennis Chair,Dark Gray,4,No 75433,Chad,Julian Chair,White,5,Yes 76590,Alisia,Ok Chair,White,4,Yes 80839,Hisako,Antonio Chair,Wheat,3,no 9536,Quyen,Melina Chair,Black,2,YES 75375,Vernell,Mazie Chair,White,4,Yup 3942,Summer,Erin Chair,Black,1,No 76451,Darrin,Buena Chair,Wheat,2,no 23648,Eliza,Abigail Chair,Wheat,3,y 14582,Jeffry,Major Chair,Black,1,yes 50998,Andreas,Natosha Chair,Black,5,n 46268,Carline,Ahmad Chair,Black,2,yes 89933,Tamekia,Kiana Chair,White,4,nope 80754,Allegra,Ileen Chair,Wheat,3,NO 8264,Danyel,Ora Chair,Dark Gray,6,n 8791,Elma,Sherita Chair,Wheat,5,yup 34577,Sima,Krystal Chair,White,2,N 53867,Kent,Kourtney Chair,Dark Gray,6,Y 16479,Adelia,Ngan Chair,White,1,Yes 16507,Romaine,Horacio Chair,Black,5,n 63730,Avis,Beryl Chair,Black,5,yes 99685,Kimi,Un Chair,White,4,nop 36993,Madelyn,Oneida Chair,White,2,y 2018,Carolann,Temika Chair,Wheat,1,no Sample Assignment Assignment 10 Name: ___________________________ CSC-1110 Section: ______ Assignment 10 COMPLETE THE HONOR CODE BELOW HONOR CODE: I pledge that this program represents my own program code, I have received help from no one and I have given help to no one. OR I received help from NAME OR NO ONE in designing and debugging my program. I have given help to NAME OR NO ONE in designing and debugging my program. This assignment is required. The grading form shows point values for this assignment. Please review it now. Show screen shots of the python code with comments and your input/output window. You should use several well-planned sets of data to check out your program. Testing your programs with just the data that is asked for in the assignment does not necessarily mean that the programs will work for all cases. Please include the following comments in each of your Python programs: Your Name Section Date Description Assignment Number A python template (python_template.py) has been provided for you to use. Name this document XXX_Assignment 10 where XXX are your initials. Include a python file named P01.py, P02.py, etc. for each problem. 1. Write a class called Chair. This Chair class should have the following fields: · _ _id: This is the unique id of the chair. · _ _make: This the make of the chair · _ _model: This is the model of the chair · _ _color: this is the color of the chair · _ _no_legs: this is the numbers of legs the chair has. NOTE: if the value is less than 2 raise ValueError. · _ _rollers: this is a boolean (not yes and no) field the determines if the legs have rollers Add the following methods: · __str__: This is the print method that will print the following information: · get_id: This method returns the value of the id field. · get_make: This method returns the make · get_model: This method returns the model · get_color: This method returns the color · get_no_legs: This method returns the number of legs · get_rollers: This method returns yes if the chair has wheels or no if it does not · set_id: This method sets the value of the id field. · set_make: This method sets the make · set_model: This method sets the model · set_color: This method sets the color · set_no_legs: This method sets the number of legs. NOTE: if the value is less than 2 raise ValueError. · set_rollers: This method accepts a Yes or Y & No or N values. The case does not matter. Therefore, yes or YES should be treated as the same. If Yes sets the rollers field to true or false if not. If any other value is received raise ValueError. PLACE SCREEN SHOTS OF THE STUDENT CLASS CODE BELOW. 2. Write a program that opens the chair_inventory.txt file. HINT: Remember to use rstrip(‘\r\n’) when getting each line from the file. The file contains information for an unknown number of records. All values are separated by a comma. The values in each row are as follows id, make, model, color, number of legs, and rollers for each chair object. Your program should split each row and create a chair object from each row. Your program will use the __str__ of the Chair class to output the result for each chair in the file. The program will keep track of each line that had an error and will report at the end. The output of your program should look like the following: Chair ID: 14587 Make: Steelcase Model: Gesture Chair Color: Brown No of Legs: 3 Rollers: No Chair ID: 14587 Make: Herman Miller Model: Cosm Chair Color: Brown No of Legs: 4 Rollers: No The following rows had errors: XX, XX, XX PLACE SCREEN SHOTS OF THE STUDENT CLASS CODE BELOW.
Answered Same DayApr 27, 2021

Answer To: Sample Assignment Assignment 10 Name: ___________________________ CSC-1110 Section: ______...

Rushendra answered on Apr 27 2021
149 Votes
python_assignment/Chair.py
class Chair:

# def __init__():
# def __init__(self,id,ma
ke,model,color,no_legs,rollers):
# self.__id=id
# self.__make=make
# self.__model=model
# self.__color=color
# self.__no_legs=no_legs
# self.__rollers=rollers
def __str__(self):
return "Chair ID : "+self.get_id()+"\nMake : "+self.get_make()+"\nModel : "+self.get_model()+"\nColor : "+self.get_color()+"\nNo Of Legs : "+str(self.get_no_legs())+"\nRollers : "+self.get_rollers()
def get_id(self):
return self.__id
def get_make(self):
return self.__make
def get_model(self):
return self.__model
def get_color(self):
return self.__color
def get_no_legs(self):
return self.__no_legs
def get_rollers(self):
return self.__rollers
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here