Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi need help with this python assignment, contains multiple questions! Please provide comments if possible, thank you! Question 1. Question 1a. Define a class Price

Hi need help with this python assignment, contains multiple questions! Please provide comments if possible, thank you! image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Question 1. Question 1a. Define a class Price that satisfies the following specifications. Question 1b. Define a str and a repr dunder method for the class Price that satisfies the Question 1c. Define a class OutofStockError that satisfies the following specifications. Question 2. Question 2a. Define a class Inventory that satisfies the following specifications. Question 3 . Question 3b. Define a function that satisfies the following specifications. The checksum letter of a 7-digits number is calculated as such: d=[(i1i2i3i4i5i6i7)(2765432)]mod11 =(2i1+7i2+6i3+5i4+4i5+3i6+2i7)mod11 Where ix is the 1st to last of the 7 digits of the 7-digits number and (2,7,6,5,4,3,2) are the weights. The checksum is a letter which corresponds to the number d as shown in the look-up table below Question 4a Define a function that meets the following specifications. Part 2 A typical vehicle registration number comes in the format xxx####y: - x - prefixes - \#- Numerical series (from 1 to 9999 , without leading zeroes) - y - Checksum - The checksum letter is calculated by first converting the letters into numbers, i.e., where A=1 and Z=26, and numbers to individual digits, potentially giving six individual numbers from the registration plate. - However, only two letters of the prefix are used in the checksum. For a three-letter prefix, only the last two letters are used; for a two-letter prefix, both letters are used; for a single letter prefix, the single letter corresponds to the second position, with the first position as 0 . - For numerals less than four digits, additional zeroes are added in front as placeholders, for example "1" is "0001". SBS 3229 would therefore give 2, 19, 3, 2, 2 and 9 (note that "S" is discarded); E 12 would give 0,5,0,0,1 and 2. SS 108 would be given as 19,19,0,1,0,8. - Each individual number is then multiplied by 6 fixed numbers (9,4,5,4,3,2). These are added up, then divided by 19. The remainder corresponds to one of the 19 letters used (A, Z, Y, X, U, T, S,R,P,M,L,K,J,H,G,E,D,C,B ), with "A" corresponding to a remainder of 0 , "Z" corresponding to 1 , "Y" corresponding to 2 and so on. In the case of SBS 3229 , the final letter should be a P; for E 23, the final letter should be a H. SS 11 back letter should be a T. The letters F,I,N,O,Q,V and W are not used as checksum letters. Define a function that meets the following specifications

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

=+ (c) The same, but suppose that 22 is uncountable.

Answered: 1 week ago

Question

How important is the division of labor to a capitalist economy

Answered: 1 week ago