PYTHON 3 Object Oriented Programming *Only Need Questions 1-3 ***a9q3.py File Below*** Class GradeItem(object):
PYTHON 3 Object Oriented Programming *Only need questions 1-3 ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything a course uses in a grading scheme, # like a test or an assignment. It has a score, which is assessed by # an instructor, and a maximum value, set by the instructor, and a weight, # which defines how much the item counts towards a final grade. def __init__(self, weight, scored=None, out_of=None): “”” Purpose: Initialize the GradeItem object. Preconditions: :param weight: the weight of the GradeItem in a grading scheme :param scored: the scored obtained in the grade item :param out_of: the maximum possible score for the grade item “”” self.weight = weight self.scored = scored self.out_of = out_of def __str__(self): “”” Purpose: Represent the Grade object as a string. If the item has not been assessed yet, N/A is used. This function gets called by str(). Return: A string representation of the Grade. “”” if self.scored is None or self.out_of is None: return ‘N/A’ else: return str(self.scored) ‘/’ str(self.out_of) def record_outcome(self, n, d): “”” Purpose: Record the outcome of the GradeItem. Preconditions: :param n: The score obtained on the item :param d: The maximum score on the item Post-conditions: Changes the data stored in the GradeItem Return: None “”” self.scored = n self.out_of = d def contribution(self): “”” Purpose: Calculate and return the contribution this GradeItem makes to a grading scheme. If the item has not been assessed, a value of zero is returned. Return: The weighted contribution of the GradeItem. “”” if self.scored is None or self.out_of is None: return 0 else: return self.weight * self.scored / self.out_of class StudentRecord(object): def __init__(self, first, last, st_number): “”” Purpose: Initialize the Student object. Preconditions: :param first: The student’s first name, as a string :param last: The student’s last name, as a string :param st_number: The student’s id number, as a string “”” self.first_name = first self.last_name = last self.id = st_number self.midterm = None self.labs = [] def drop_lowest(self, grades): “”” Purpose: Sets the weight of the lowest grade in grades to zero. Pre-conditions: :param grades: a list of GradeItems Post-conditions: One of the grade items has its weight set to zero Return: :return: None “”” pass def calculate(self): “”” Purpose: Calculate the final grade in the course. Return: The final grade. “”” return round(self.midterm.contribution() sum([b.contribution() for b in self.labs])) def display(self): “”” Purpose: Display the information about the student, including all lab and assignment grades, and the calculation of the total grade. :return: “”” print(“Student:”, self.first_name, self.last_name, ‘(‘ self.id ‘)’) print(“tCourse grade:”, self.calculate()) print(‘tMidterm:’, str(self.midterm)) # print(‘tLabs:’, end=” “) for g in self.labs: if g.weight == 0: print(‘[‘ str(g) ‘]’, end=’ ‘) else: print(str(g), end=’ ‘) print() def read_student_record_file(filename): “”” Purpose: Read a student record file, containing information about the student. Line 1: Out of: the maximum score for the grade items Line 2: Weight: the weight of the grade items in the grading scheme Lines 3…: Student records as follows: Student Number, Lastname, Firstname, 10 lab marks, 10 assignment marks, midterm, final Pre-conditions: :param filename: A text file, comma-separated, with the above format. Return: :return: A list of StudentRecords constructed from the named file. “”” f = open(filename) # Second line tells us what the grade items are out of out_of_line = f.readline().rstrip().split(‘,’) out_of = [int(i) for i in out_of_line[1:]] lab_out_of = out_of[0:10] assignments_out_of = out_of[10:20] mt_out_of = out_of[20] final_out_of = out_of[21] # Third line tells us the weight of each item weight_line = f.readline().rstrip().split(‘,’) weights = [int(i) for i in weight_line[1:]] lab_weights = weights[0:10] assignment_weights = weights[10:20] mt_weight = weights[20] final_weight = weights[21] # Read all the students in the file: students = list() for line in f: student_line = line.rstrip().split(‘,’) student = StudentRecord(student_line[2],student_line[1],student_line[0]) labs = [int(lab) for lab in student_line[3:13]] assignments = [int(a) for a in student_line[13:23]] for g,o,w in zip(labs,lab_out_of,lab_weights): student.labs.append(GradeItem(w,g,o)) student.midterm = GradeItem(mt_weight,int(student_line[23]),mt_out_of) students.append(student) return students if __name__ == ‘__main__’: course = read_student_record_file(‘students.txt’) # display the students print(‘————- Before —————‘) for s in course: s.display() # drop lowest lab for all students for s in course: s.drop_lowest(s.labs) # display the students print(‘————- After —————-‘) for s in course: s.display() ***Students.txt file below*** Out of,4,4,4,4,4,4,4,4,4,4,41,50,35,60,70,55,45,50,60,60,60,90 Weights,1,1,1,1,1,1,1,1,1,1,4,4,4,4,4,4,4,4,4,4,10,40 3111332,Einstein,Albert,4,4,3,4,4,3,4,3,3,4,39,46,34,58,65,45,25,10,40,35,35,50 3216842,Curie,Marie,3,4,3,4,3,4,1,4,1,4,41,45,30,50,61,48,37,43,55,58,55,85 ***The solution code returns 78.5 of avg when the lowest grades are NOT dropped from the student.txt file. On the other hand, if they ARE dropped for BOTH labs and assignments, the avg becomes 80.5
The Difference Between MAPE And MASE Is That MASE Gives A Heavier Penalty To
The difference between MAPE and MASE is that MASE gives a heavier penalty to positive errors (over forecasts) than negative forecasts (under forecasts), while MAPE weighs both types of errors equally. true or false Naïve Forecasts are example of extrapolation method. true or false The principle of improving forecast precision via ensembles is the same principle underlying the advantage portfolios and diversification in financial investment. true or false With moving average forecasting or visualization, the only choice that the user must make is the width of the window (w) . true or false
Here Is The Question And My Code Of Excel VBA. The Line In My
Here is the question and my code of Excel VBA. The line in my code is always highlighted and says ‘overflow’ I am wondering how I can fix it.
Rewrite The Program Shown Below So That It Is No Longer Vulnerable To A
Rewrite the program shown below so that it is no longer vulnerable to a buffer overflow. Please add explanation. Thank you. int main(int argc, char *argv[]){ int valid = FALSE; char str1[8]; char str2[8]; next_tag(str1); gets(str2); if (strncmp(str1, str2, 8) == 0) valid = TRUE; printf(“buffer1: str1(%s), str2(%s), valid(%d)n”, str1, str2, valid); }
(The Account Class) Design A Class In Java Named Account That Contains: A Private
(The Account class) Design a class in Java named Account that contains: A private int data field named id for the account (default 0). A private double data field named balance for the account (default 0). A private double data field named annualInterestRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. A private Date data field named dateCreated that stores the date when the account was created. A no-arg constructor that creates a default account. A constructor that creates an account with the specified id and initial balance. The accessor and mutator methods for id, balance, and annualInterestRate. The accessor method for dateCreated. A method named getMonthlyInterestRate() that returns the monthly interest rate. A method named withdraw that withdraws a specified amount from the account. A method named deposit that deposits a specified amount to the account. Draw the UML diagram for the class. Implement the class. Write a test program that creates an Account object with an account ID of 1122, a balance of $20,000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2,500, use the depositmethod to deposit $3,000, and print the balance, the monthly interest, and the date when this account was created. public class Test { public static void main (String[] args) { Account account = new Account(1122, 20000); Account.setAnnualInterestRate(4.5); account.withdraw(2500); account.deposit(3000); System.out.println(“Balance is ” account.getBalance()); System.out.println(“Monthly interest is ” account.getMonthlyInterest()); System.out.println(“This account was created at ” account.getDateCreated()); } } Class Account { // Implement the class here }
Consider A Grid Where Each Cell Has A Different Cost To Travel Across The
Consider a grid where each cell has a different cost to travel across the regions. Assume we can only travel and stop in straight lines between the corners of these cells. Note that the cost to travel along a border between two cells is the cheapest of the two. We want to find the cheapest route from the lower-left corner to the upper-right corner of the grid under these constraints. For example in the following 3 × 3 grid, one of the cheapest routes of cost 2 3 4 2=11 is highlighted. We will read in a sequence of problem instances. The first line will contain two positive integers n and m, both at most 400, denoting the dimensions of the grid; here the number of rows is n and the number of columns is m. We then are given n lines of m non-negative integers representing the costs for the cells. All integers will be separated by spaces. The last problem instance will have values of n = m = 0, which is not processed. The input should be taken from keyboard/stdin/System.in. Sample Input: 3 3 0 6 2 1 8 4 2 3 7 3 5 1 3 9 9 1 5 10 1 8 4 2 7 8 2 6 0 0 The output for each instance should be a single integer (one per line) denoting the minimum cost to travel. Print these to the console/stdout/System.out. Sample Output: 11 17 You need to submit a single Python source program (Python 3). There will be three inputs of several test cases of increasing difficulty.
Write A C Program That Takes Two Numbers From The Command Line And Perform
Write a C program that takes two numbers from the command line and perform and arithmetic operations with them. Additionally your program must be able to take three command line arguments where if the last argument is ‘a’ an addition is performed, and if ‘s’ then subtraction is performed with the first two arguments. Do not use ‘cin’ or gets() type functions. Do not for user input. All input must be specified on the command line separated by blank spaces (i.e. use the argv and argc input parameters). Example1: Exercise1_1234567.exe 10 2 a which should return 10 2 = 12, i.e. the last (and only) line on the console will be: 12
Use The Weka Vote.arff To Answer The Questions Below: Select A Dataset That Is
Use the Weka vote.arff to answer the questions below: Select a dataset that is appropriate for association rule mining, and perform the following tasks o Prepare and preprocess the data if needed. o Use the Weka tools to find the rules and appropriate parameter settings. o Determine the ten most important rules, and explain how they could be useful. o Write a short report that explains your work and address the following issues: o Description of the data, and statement of the mining problem. o Approach used for the mining. o Description of the experiments, and discussion of the results. o Conclusion that summarizes the findings and limitations/challenges faced during this work.
Using The Input Argument Phrase ‘Huge Dog 123.56’, Develop A C Script So That
Using the input argument phrase ‘Huge Dog 123.56’, develop a C script so that it counts the number of characters entered in the first argument and displays the number to the console. Argument one (‘Huge) should result in the number 4 being displayed to the console screen. It should be displayed on a separate line with no other characters or text. Using the command line arguments phrase ‘Huge Dog 123.56’, your console should display: 4, 3 and 6 on separate lines.
Write A Program That Prompts The User To Input A String And Outputs
Write a program that prompts the user to input a string and outputs the string in uppercase letters. (Use dynamic arrays to store the string.) my code below: /* Your code from Chapter 8, exercise 5 is below. Rewrite the following code to using dynamic arrays. */ #include #include #include using namespace std; int main() { //char str[81]; //creating memory for str array of size 80 using dynamic memory allocation char *str = new char[80]; int len; int i; cout << "Enter a string: "; cin.get(str, 80); cout << endl; cout << "String in upper case letters is:"<< endl; len = strlen(str); //displaying each character in upper case letter for (i = 0; i < len; i ) cout << static_cast(toupper(*(str i))); cout << endl; return 0; } keeping getting it wrong need help not sure what im doing wrong Input 11 Hello World Output Enter a string: 11 String in upper case letters is: 11 Hello World Test Case Incomplete To Upper Test 2 Input 14 I love to code Output Enter a string: 14 String in upper case letters is: 14 I love to code
In This Checkpoint We Will Be Using CSS To Provide Basic Visual Changes To
Get college assignment help at Smashing Essays please help me to solve this HTML question, thanks a lot !
Write In Java : Given The Following Graph, Write The Dijkstra’s Code To Find
Write in java : Given the following graph, write the Dijkstra’s code to find the minimum distance from each node to all other nodes. The output of the code must specify each starting node and the path from source to each of the destinations. In addition, using paper pencil technique (the steps used in the lecture) find the shortest path having node-C as the source. Note that the program must have a while loop to change the source at each new iteration of the while loop.
Write In Java: Assume The Above Graph Is Undirected Path. Find The Minimum Spanning
Write in java: Assume the above graph is undirected path. Find the minimum spanning tree using disjoint set technique. Write the program and also show this using the paper pencil technique (using the steps shown in lecture notes).
Write In Java : Given The Following Graph, Write The Dijkstra’s Code To Find
Write in java : Given the following graph, write the Dijkstra’s code to find the minimum distance from each node to all other nodes. The output of the code must specify each starting node and the path from source to each of the destinations. In addition, using paper pencil technique (the steps used in the lecture) find the shortest path having node-C as the source. Note that the program must have a while loop to change the source at each new iteration of the while loop.
Write In Java: Assume The Above Graph Is Undirected Path. Find The Minimum Spanning
Compute The Maximum Flow Of The Following Flow Network Using The Edmonds-Karp Algorithm, Where
Compute the maximum flow of the following flow network using the Edmonds-Karp algorithm, where the source is S and the sink is T. Beginning with the path (S, C, D, T ) show the residual network after each flow augmentation. Write down the maximum flow value. Write in java: Assume the above graph is undirected path. Find the minimum spanning tree using disjoint set technique. Write the program and also show this using the paper pencil technique (using the steps shown in lecture notes).
Compute The Maximum Flow Of The Following Flow Network Using The Edmonds-Karp Algorithm, Where
Compute the maximum flow of the following flow network using the Edmonds-Karp algorithm, where the source is S and the sink is T. Beginning with the path (S, C, D, T ) show the residual network after each flow augmentation. Write down the maximum flow value.
Hello, Could I Get Some Help With This? Thank You Lab 9.5 – Programming
Hello, could I get some help with this? Thank you Lab 9.5 – Programming Challenge 1 — Going Green Write the Flowchartfor the following programming problem based on the pseudocode below. Last year, a local college implemented rooftop gardens as a way to promote energy efficiency and save money. Write a program that will allow the user to enter the energy bills from January to December for the year prior to going green. Next, allow the user to enter the energy bills from January to December of the past year after going green. The program should calculate the energy difference from the two years and display the two years’ worth of data, along with the savings. Hints: Create three arrays of size 12 each. The first array will store the first year of energy costs, the second array will store the second year after going green, and the third array will store the difference. Also, create a string array that stores the month names. These variables might be defined as follows: notGreenCost = [0] * 12 goneGreenCost = [0] * 12 savings = [0] * 12 months = [‘January’, ‘February’, ‘March’, ‘April’, ‘May’, ‘June’, ‘July’, ‘August’, ‘September’, ‘October’, ‘November’, ‘December’] The Pseudocode Module main() //Declare local variables Declare endProgram = “no” While endProgram == “no” Declare Real notGreenCost[12] Declare Real goneGreenCost[12] Declare Real savings[12] Declare String months[12] = “January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December” //function calls getNotGreen(notGreenCost, months) getGoneGreen(goneGreenCost, months) energySaved(notGreenCost, goneGreenCosts, savings) displayInfo(notGreenCost, goneGreenCosts, savings, months) Display “Do you want to end the program? Yes or no” Input endProgram End While End Module ModulegetNotGreen(Real notGreenCost[], String months[]) Set counter = 0 While counter < 12 Display “Enter NOT GREEN energy costs for”, months[counter] Input notGreenCosts[counter] Set counter = counter 1 End While End Module ModulegetGoneGreen(Real goneGreenCost[], String months[]) Set counter = 0 While counter < 12 Display “Enter GONE GREEN energy costs for”, months[counter] Input goneGreenCosts[counter] Set counter = counter 1 End While End Module Module energySaved(Real notGreenCost[], Real goneGreenCost[], Real savings[]) Set counter = 0 While counter < 12 Set savings[counter] = notGreenCost[counter] – goneGreenCost[counter] Set counter = counter 1 End While End Module Module displayInfo(Real notGreenCost[], Real goneGreenCost[], Real savings[], String months[]) Set counter = 0 While counter < 12 Display “Information for”, months[counter] Display “Savings $”, savings[counter] Display “Not Green Costs $”, notGreenCost[counter] Display “Gone Green Costs $”, goneGreenCost[counter] End While End Module The Flowchart PASTE FLOWCHART HERE The Python Code for Review #the main function def main(): endProgram = 'no' print whileendProgram == 'no': print # declare variables notGreenCost = [0] * 12 goneGreenCost = [0] * 12 savings = [0] * 12 months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] # function calls getNotGreen(notGreenCost, months) getGoneGreen(goneGreenCost, months) energySaved(notGreenCost, goneGreenCost, savings) displayInfo(notGreenCost, goneGreenCost, savings, months) endProgram = raw_input('Do you want to end program? (Enter no or yes): ') while not (endProgram == 'yes' or endProgram == 'no'): print 'Please enter a yes or no' endProgram = raw_input('Do you want to end program? (Enter no or yes): ') #ThegetNotGreen function defgetNotGreen(notGreenCost, months): counter = 0 while counter ‘) counter = counter 1 print ‘————————————————-‘ #ThegoneGreenCost function defgetGoneGreen(goneGreenCost, months): print counter = 0 while counter ‘) counter = counter 1 print ‘————————————————-‘ #determines the savings function defenergySaved(notGreenCost, goneGreenCost, savings): counter = 0 while counter < 12: savings[counter] = notGreenCost[counter] – goneGreenCost[counter] counter = counter 1 #Displays information defdisplayInfo(notGreenCost, goneGreenCost, savings, months): counter = 0 print print ' SAVINGS ' print '_____________________________________________________' print 'SAVINGS NOT GREEN GONE GREEN MONTH' print '_____________________________________________________' while counter < 12: print print '$', savings[counter], ' $', notGreenCost[counter], ' $', goneGreenCost[counter], ' ', months[counter] counter = counter 1 print # calls main main()
Write In Java : Given The Following Graph, Write The Dijkstra’s Code To Find
Write in java : Given the following graph, write the Dijkstra’s code to find the minimum distance from each node to all other nodes. The output of the code must specify each starting node and the path from source to each of the destinations. In addition, using paper pencil technique (the steps used in the lecture) find the shortest path having node-C as the source. Note that the program must have a while loop to change the source at each new iteration of the while loop.
Write In Java: Assume The Above Graph Is Undirected Path. Find The Minimum Spanning
Write in java: Assume the above graph is undirected path. Find the minimum spanning tree using disjoint set technique. Write the program and also show this using the paper pencil technique (using the steps shown in lecture notes).
Hello, Could I Get Some Help With This? Thank You Lab 9.5 – Programming
Hello, could I get some help with this? Thank you Lab 9.5 – Programming Challenge 1 — Going Green Write the Flowchartfor the following programming problem based on the pseudocode below. Last year, a local college implemented rooftop gardens as a way to promote energy efficiency and save money. Write a program that will allow the user to enter the energy bills from January to December for the year prior to going green. Next, allow the user to enter the energy bills from January to December of the past year after going green. The program should calculate the energy difference from the two years and display the two years’ worth of data, along with the savings. Hints: Create three arrays of size 12 each. The first array will store the first year of energy costs, the second array will store the second year after going green, and the third array will store the difference. Also, create a string array that stores the month names. These variables might be defined as follows: notGreenCost = [0] * 12 goneGreenCost = [0] * 12 savings = [0] * 12 months = [‘January’, ‘February’, ‘March’, ‘April’, ‘May’, ‘June’, ‘July’, ‘August’, ‘September’, ‘October’, ‘November’, ‘December’] The Pseudocode Module main() //Declare local variables Declare endProgram = “no” While endProgram == “no” Declare Real notGreenCost[12] Declare Real goneGreenCost[12] Declare Real savings[12] Declare String months[12] = “January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December” //function calls getNotGreen(notGreenCost, months) getGoneGreen(goneGreenCost, months) energySaved(notGreenCost, goneGreenCosts, savings) displayInfo(notGreenCost, goneGreenCosts, savings, months) Display “Do you want to end the program? Yes or no” Input endProgram End While End Module ModulegetNotGreen(Real notGreenCost[], String months[]) Set counter = 0 While counter < 12 Display “Enter NOT GREEN energy costs for”, months[counter] Input notGreenCosts[counter] Set counter = counter 1 End While End Module ModulegetGoneGreen(Real goneGreenCost[], String months[]) Set counter = 0 While counter < 12 Display “Enter GONE GREEN energy costs for”, months[counter] Input goneGreenCosts[counter] Set counter = counter 1 End While End Module Module energySaved(Real notGreenCost[], Real goneGreenCost[], Real savings[]) Set counter = 0 While counter < 12 Set savings[counter] = notGreenCost[counter] – goneGreenCost[counter] Set counter = counter 1 End While End Module Module displayInfo(Real notGreenCost[], Real goneGreenCost[], Real savings[], String months[]) Set counter = 0 While counter < 12 Display “Information for”, months[counter] Display “Savings $”, savings[counter] Display “Not Green Costs $”, notGreenCost[counter] Display “Gone Green Costs $”, goneGreenCost[counter] End While End Module The Flowchart PASTE FLOWCHART HERE The Python Code for Review #the main function def main(): endProgram = 'no' print whileendProgram == 'no': print # declare variables notGreenCost = [0] * 12 goneGreenCost = [0] * 12 savings = [0] * 12 months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] # function calls getNotGreen(notGreenCost, months) getGoneGreen(goneGreenCost, months) energySaved(notGreenCost, goneGreenCost, savings) displayInfo(notGreenCost, goneGreenCost, savings, months) endProgram = raw_input('Do you want to end program? (Enter no or yes): ') while not (endProgram == 'yes' or endProgram == 'no'): print 'Please enter a yes or no' endProgram = raw_input('Do you want to end program? (Enter no or yes): ') #ThegetNotGreen function defgetNotGreen(notGreenCost, months): counter = 0 while counter ‘) counter = counter 1 print ‘————————————————-‘ #ThegoneGreenCost function defgetGoneGreen(goneGreenCost, months): print counter = 0 while counter ‘) counter = counter 1 print ‘————————————————-‘ #determines the savings function defenergySaved(notGreenCost, goneGreenCost, savings): counter = 0 while counter < 12: savings[counter] = notGreenCost[counter] – goneGreenCost[counter] counter = counter 1 #Displays information defdisplayInfo(notGreenCost, goneGreenCost, savings, months): counter = 0 print print ' SAVINGS ' print '_____________________________________________________' print 'SAVINGS NOT GREEN GONE GREEN MONTH' print '_____________________________________________________' while counter < 12: print print '$', savings[counter], ' $', notGreenCost[counter], ' $', goneGreenCost[counter], ' ', months[counter] counter = counter 1 print # calls main main()
Hi, Some Help With This Would Be Appreciated. Thank You *Edit*During This Course You
Hi, some help with this would be appreciated. Thank you *Edit*During this course you will design a program for a state university. The university needs a website design that will enable students to order books online. Each week you will receive additional instructions for the elements of the design based on the needs of the university. The elements will correspond with the concepts and skills you learn that week. According to the university’s website design request, students need to order five books, one for each of the five required courses that all students take. You need to design a program that will prompt students for the price of each book and display the total cost for the five books. *Edit* Update the website program to reflect the following changes: Use an array to prompt the user to enter a credit card account number Use the sequential search algorithm to locate the credit card number entered by the user If the credit card number is not in the array, display a message indicating the number is invalid If the credit card number is in the array, display a message indicating the credit card number is valid Create a 1/2- to 1-page document containing pseudocode based on the revised program needs. Add the pseudocode statements to the existing pseudocode program. Create a 1- to 2-page flowchart based on the algorithm for the revised program needs. Add the flowchart structure in the existing flowchart for the program. Submit your assignment.
The post PYTHON 3 Object Oriented Programming *Only Need Questions 1-3 ***a9q3.py File Below*** Class GradeItem(object): appeared first on Smashing Essays.
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
