Written in python using puTTy!!
i'm having a lot of trouble with this, will upvote!
also here is the address.csv file
Name,Phone,Email,Year_of_Birth
Elizi Moe,5208534566,[email protected],1978
Ma Ta,4345667345,[email protected],1988
Diana Cheng,5203456789,[email protected],1970
ACTIVITY I
Implement in Python the Subscriber class modeled by the UML diagram provided below. Save in a file called MyClasses.py
Subscriber
name: string
yearOfBirth: int
phone: string
email: string
getName()
getAge()
getPhone()
getEmail()
Write a test program that does the following:
Read the file addresses.csv.
For each record, create an object with the information in the file.
Note that the file has 3 records, so 3 objects must be dynamically
created.
Print the name, email, and age in a tabulated format as shown
below
Name Email Age
Elizi Moe [email protected] 40
Ma Ta [email protected] 30
Diana Cheng [email protected] 48
ACTIVITY II
Modify your Subscriber class so that:
The current year is a global variable, taken from the user
The program keeps a count of the number of subscribers
instantiated
You must print the same information as in the previous exercise, and in the same format; but also the number of subscribers in the form: “There were xxx subscribers in the file”.
ACTIVITY III
Implement in Python the Subscriber_v2 class modeled by the UML diagram provided below. Save in a file called MyClasses.py
Subscriber_v2
- name: string
- age: int
- phone: string
- email: string
+ getName()
+ getAge ()
+ getPhone()
+ getEmail()
+ setName(name:string)
+ setAge(birthYear:int)
+ setPhone(ph:string)
+ setEmail(email:string)
Write a test program that does the following:
Read the file addresses.csv.
For each record, create an object with the information in the file.
Note that the file has 3 records, so 3 objects must be dynamically
created.
Print the name, email, and age in a tabulated format as shown
below
Name Email Age
Elizi Moe [email protected] 40
Ma Ta [email protected] 30
Diana Cheng [email protected] 48
There were 3 subscribers in the file
ACTIVITY IV
Design a class named Stock (add to the file MyClasses.py) to represent a company’s stock that contains:
A private string data field named symbol for the stock’s
symbol
A private string data field named name for the stock’s name
A private float data field named previousClosingPrice that stores
the stock price for the previous day
A private float date field names currentPrice that stores the stock
price for the current time
A constructor that creates a stock with the specified symbol, name,
previous price, and current price
A get method for returning the stock name
A get method for returning the stock symbol
Get and set methods for getting/setting the stock’s previous
price
Get and set methods for getting/setting the stock’s current
price
A method names getChangePercent() that returns the percentage
changed from previousClosingPrice to currentPrice
(1) Draw a UML diagram for the class, and then implement the class
(2) Write a test program that creates a Stock object with the stock symbol INTC, the name Intel Corporation, the previous closing price of 20.5, and the new current price of 20.35, and display the price-change percentage
ACTIVITY V
Implement the subclass Rectangle of the the superclass GeometricObject defined by the UML diagram below
Sample Run:
A rectangle color: green and filled: True
The area is 8
The perimeter is 12
ACTIVITY I and II
class Subscriber():
current_year=0
subscriber_count=0
def __init__(self,name,year_of_birth,phone,email):
self.name=name
self.year_of_birth = year_of_birth
self.phone=phone
self.email=email
Subscriber.subscriber_count+=1
def getName(self):
return self.name
def getAge(self):
return Subscriber.current_year-self.year_of_birth
def getPhone(self):
return self.phone
def getEmail(self):
return self.email
def main():
persons=[]
Subscriber.current_year=2018
sub1=Subscriber('Elizi', 1978, '1234567890', '[email protected]')
sub2=Subscriber('Ma Ta', 1988, '1234567890', '[email protected]')
sub3=Subscriber('Diana Cheng', 1970, '1234567890',
'[email protected]')
persons.append(sub1)
persons.append(sub2)
persons.append(sub3)
print('{0:<15}{1:<15}{2:>4}'.format("Name","Email","Age"))
for person in persons:
print('{0:<15}{1:<15}{2:>4}'.format(person.getName(),person.getEmail(),person.getAge()))
print('\nThere were', Subscriber.subscriber_count ,'subscribers in
the file')
main()
OUTPUT:
Written in python using puTTy!! i'm having a lot of trouble with this, will upvote! also...
Python only please, thanks in advance. Type up the GeometricObject class (code given on the back of the paper). Name this file GeometricObjectClass and store it in the folder you made (xxlab14) 1. Design a class named Rectangle as a subclass of the GeometricObject class. Name the file RectangleClass and place it in the folder. 2. The Rectangle class contains Two float data fields named length and width A constructor that creates a rectangle with the specified fields with default...
Python only please, thanks in advance. Type up the GeometricObject class (code given on the back of the paper). Name this file GeometricObjectClass and store it in the folder you made (xxlab14) 1. Design a class named Rectangle as a subclass of the GeometricObject class. Name the file RectangleClass and place it in the folder. 2. The Rectangle class contains Two float data fields named length and width A constructor that creates a rectangle with the specified fields with default...
JAVA PROGRAM USING ECLIPSE. THE FIRST IMAGE IS THE INSTRUCTIONS, THE SECOND IS THE OUTPUT TEST CASES(WHAT IM TRYING TO PRODUCE) BELOW THOSE IMAGES ARE THE .JAVA FILES THAT I HAVE CREATED. THESE ARE GeometircObject.Java,Point.java, and Tester.Java. I just need help making the Rectangle.java and Rectangle2D.java classes. GeometricObject.Java: public abstract class GeometricObject { private String color = "white"; // shape color private boolean filled; // fill status protected GeometricObject() { // POST: default shape is unfilled blue this.color = "blue";...
You have just been hired as an analyst for an investment firm. Your first assignment is to analyze data for stocks in the S&P 500. The S&P 500 is a stock index that contains the 500 largest publicly traded companies. You have been given two sources of data to work with. The first is an XML file that contains the Symbol (ticker), company name, sector, and industry for every stock in the S&P 500, as of summer 2016. The second...
C++ project we need to create a class for Book and Warehouse using Book.h and Warehouse.h header files given. Then make a main program using Book and Warehouse to read data from book.dat and have functions to list and find book by isbn Objectives: Class Association and operator overloading This project is a continuation from Project 1. The program should accept the same input data file and support the same list and find operations. You will change the implementation of...
could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...