Computer-aided software engineering tool

Assignment Help Python Programming
Reference no: EM133087586

Lab - Objects, Class Diagrams and UML

Introduction

We had a brief look at Objects in week 6 - this week we revisit objects together with a look at a Computer-aided software engineering (CASE) tool - Enterprise Architect (EA).

Consider the following Python code that we looked at in week 6:

class Student():
def init (self, first_name, last_name, student_id): self.first_name = first_name
self.last_name = last_name self.student_id = student_id
def display(self):
print("{0}, {1} ({2})").format(last_name, first_name,
student_id))
We could draw a class diagram by hand - which is fine - if it is only a small class or two; if the code involves many more classes some help is greatly appreciated. Let us take a quick look at EA; on Startup, The screen should look something like this:

Cancel the Startup Dialog and close the Start Page. From the Menu choose File -> New Project and create a new project called Week10.

Use the code in week 6 for the Car and ElectricCar (the first version is fine). It should look something like this. (In this case a main class has also been and imported together with Car.py and ElectricCar.py)

Note that ElectricCar has inherited from Car. You can click on the instantiation of an electric car and view its attributes.

Enterprise Architect is an industrial strength CASE tool which lets us do many things.

Just one more thing. Consider the following code:

"""
File: Student.py
Resources to manage a student's name and test scores. """
class Student(object): """Represents a student."""
def init (self, name, number):
"""Constructor creates a Student with the given name and number of scores and sets all scores to 0."""
self.name = name self.scores = []
for count in range(number): self.scores.append(0)

def getName(self):
"""Returns the student's name.""" return self.name

def setScore(self, i, score):
"""Resets the ith score, counting from 1.""" self.scores[i - 1] = score

def getScore(self, i):
"""Returns the ith score, counting from 1.""" return self.scores[i - 1]
def getAverage(self):
"""Returns the average score."""
return sum(self.scores) / len(self.scores) def getHighScore(self):
"""Returns the highest score.""" return max(self.scores)
def str (self):
"""Returns the string representation of the

student."""
return "Name: " + self.name + "\nScores: " + \ " ".join(map(str, self.scores))

Notice the triple docs (""" """) at 3 different levels. The first level is that of the module.
The second level is just after the class header. There might be more than one class defined in a module, so each class can have a docstring to describe its purpose.
The third level is located after each method header.

Attachment:- Class Diagrams and UML.rar

Reference no: EM133087586

Questions Cloud

Perception of victim by different constituents : Discuss whether factors of class, race, and sexual orientation affect the perception of the victim by different constituents, including the public,
Juvenile delinquency : Should we as a society blame a child who grows up in such an environment for criminal acts?
About differences between races-marriage and education : Think about a former belief you might have had about differences between races, marriage, and/or education.
Information regarding hate crime laws : You will read a specific hate crime example and information regarding hate crime laws
Computer-aided software engineering tool : Draw a class diagram by hand - which is fine - if it is only a small class or two; if the code involves many more classes some help is greatly appreciated
Write a reflection on how you managed your time : Write a reflection on how you managed your time, utilising the timetable and using Pomodoro or Eisenhower to manage your study. Use Gibb's model to structure yo
Contrast the four ways managers make decisions : Compare and contrast the four ways managers make decisions.
Gibb model to structure reflection : Write a reflection on how you managed your time, utilising the timetable and using Pomodoro or Eisenhower to manage your study. Use Gibb's model to structure yo
Course sustainable business management : How would you describe the strategy of the company?

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd