class ClassStats: def __init__(self, number, status): self.__status = status self.__number = number def get_status(self): return self.__status def get_number(self): return self.__number if __name__ == "__main__": with open("passfail.txt", 'r') as file: data = file.readlines() students = [] passes = [] failed = [] j = 0 print(data) for line in data: # words.append(line.split("\n")) x, y = line.split() print(x, y) students.append(ClassStats(int(x), y)) for classes in students: if classes.get_status() == "pass": passes.append(classes) else: failed.append(classes) def percentage(list1, list2, total): passed = (len(list1) / len(total)) * 100 fails = 100 - passed print("The Percentage Of Student Passed : ", passed) print("The Percentage of Student Failed : ", fails) print(students) print(passes) print(failed) percentage(passes, failed, students)
3. Design and implement a class called ClassStats, in a file called stats.py, that includes: •...
2. In a file called passfail.py, write a Python program to solve the following problem: Given a file students.txt with the following information for a stu dent: student number, average quiz mark, average assignment mark, midterm exam mark, and final exam mark (where each mark is recorded out of 100), de termine if the student has passed or failed based on the following information A student will pass the course if they have a passing mark (50% or higher) for...
python question 2. In a file called passfail.py, write a Python program to solve the following problem: Given a file students.txt with the following information for a stu dent: student number, average quiz mark, average assignment mark, midterm exam mark, and final exam mark (where each mark is recorded out of 100), de termine if the student has passed or failed based on the following information: • A student will pass the course if they have a passing mark (50%...
Create a class called Login which contains a HashMap as a private attribute. It should also have an instance method called loadCredentials which acccepts the two arrays. It will load the Hash Map with key/value pairs based on the two arrays above. The userNames should be the keys and the passwords the values. private static String[] userNameArray = {"John", "Steve", "Bonnie", "Kylie", "Logan", "Robert"); private static String) passwordArray = {"1111", "2222", "3333", "4444", "5555", "6666"}; Create a login method in...
you must implement public class Student by following the instructions as follows exactly. You may reference Chapter 7 for the similar examples to get the ideas and concepts. Each student must have the following 5 attributes (i.e., instance variables): private String studentID ; // student’s ID such as 1 private String lastName ; // student’s last name such as Doe private String firstName ; // student’s first name such as John private double gpa...
Given a class called Student and a class called Course that contains an ArrayList of Student. Write a method called getDeansList() as described below. Refer to Student.java below to learn what methods are available. I will paste both of the simple .JAVA codes below COURSE.JAVA import java.util.*; import java.io.*; /****************************************************** * A list of students in a course *****************************************************/ public class Course{ /** collection of Students */ private ArrayList<Student> roster; /***************************************************** Constructor for objects of class Course *****************************************************/...
HashMap: We can use a HashMap to store key value pairs. Reminder that only reference types can be used as the key or value. It you want to use a number as the key then an Integer data type could be used but not an int primitive data type.Create a class called Login which contains a HashMap as a private attribute. It should also have an instance method called loadCredentials which accepts the two arrays. It will load the HashMap...
Design class Person with private fields name and social security number, and a public virtual member Design class Person with private fields name and social security number, and a public virtual member function print(). Derive classes Employee and Student from Person. An employee has a private field salary and a student has a private field grade in addition to the data fields in person. Derive classes Professor and Secretary from Employee. A professor has a private field research area and...
1. Create a class called computer as a separate C# file that includes the following private attributes (data items) of the class: Manufacturer, Model Number and Price\ 2. Create properties for each attribute to get and set private data.
Implement the following class in interface and implementation files. A separate file (the main project file) shall have the main function that exercises this class. Create a class named Student that has three member variables: name - string that stores the name of the student numClasses - integer that tracks how many courses the student is currently enrolled in, this number must be between 1 and 100 ClassList - an array of strings of size 100 used to store the...
In Java(using BlueJ) Purpose Purpose is to practice using file input and output, and array list of objects. Also, this lab specification tells you only what to do, you now have more responsibility to design how to do it. Problem description You are given a text file called 'Students.txt' that contains information on many students. Your program reads the file, creating many Student objects, all of which will be stored into an array list of Student objects, in the Students...