Your Perfect Assignment is Just a Click Away
We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

Create a class diagram in enterprise architect – Software Engineering

Create a class diagram in enterprise architect – Software Engineering

Create a class diagram in enterprise architect – Software Engineering

Part A

1. Use Enterprise Architect to create a sequence diagram for the execute statement of the GoCommand class

public class GoCommand extends Command {
private GameCharacter thePlayer;
public GoCommand(GameCharacter theCharacter) {
this.thePlayer = theCharacter;
}
public String execute(String params) {
if (params == null) return “Go Where?”;
Exit theExit = getExit(params);
if (theExit == null) return “No exit there!”;
if (!takeExit(theExit))
return “I can’t take that exit now… Maybe it’s locked.”;
moveNPCs();
Location currentLocale = thePlayer.getCurrentLocation();
return currentLocale.getDescription();
}

}
2.
Define C# classes in Visual Studio according to the following specifications.
Vehicle
• instance variable representing the vehicleID (int)
• instance variable representing the odometerReading (double)
• method to return the vehicleID
• method to return the odometerReading
• Constructor with two parameters to initialise the instance variables

Car (inherits from Vehicle)
• instance variable representing the model (string)
• method to return the model
• Constructor with three parameters – vehicleID, odometerReading and model.

Customer:
• instance variable representing the customer number (string)
• instance variable representing the customer name (string)
• instance variable representing the customer’s car (Car)
• method to return the customer number
• method to return the customer name
• Constructor with four parameters – customer number, customer name, vehicle ID, and model
o The constructor should create a Car with odometer reading 0
o Assumption: One customer can have only one car
• method ToString which returns concatenated information of customer number, customer name, vehicle ID, odometer reading and model. [Hint public new String ToString()]

1. Create a class diagram in Enterprise Architect which fully represents the classes above and the relationships between them.
2. Create a NUnit test class for the Customer class and fully test all of the methods. Include an appropriate setup function for this test class.

Part B

using System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
using System.IO;

namespace ConsoleApplication1
{
classProgram
{
///<summary>
///The main entry point for the application.
///</summary>

staticvoid Main()
{

string title;
stringfName;
stringlName;
string gender;
intmedicareNo;
double height;
double weight;
int age;
string reply;
doublecal;
doubleidealWeight;

FileStream fs = newFileStream(“test.txt”, FileMode.Append, FileAccess.Write);

StreamWritersw = newStreamWriter(fs);

do
{
Console.WriteLine(“nPlease enter the Title”);
title = Console.ReadLine();
sw.WriteLine(“Title = ” + title);
Console.WriteLine(“nPlease enter the First Name of the Patient”);
fName = Console.ReadLine();
sw.WriteLine(“Name = ” + fName);
Console.WriteLine(“nPlease enter the Last Name of the Patient”);
lName = Console.ReadLine();
sw.WriteLine(“Last name = ” + lName);
Console.WriteLine(“nEnter the Gender: Male / Female”);
gender = Console.ReadLine();
sw.WriteLine(“Gender = ” + gender);
Console.WriteLine(“nPlease enter the Medicare Number”);
medicareNo = (int)Convert.ToInt64(Console.ReadLine());
sw.WriteLine(“Medicare no = ” + medicareNo);
Console.WriteLine(“nPlease enter the height in inches”);
height = (double)Convert.ToDouble(Console.ReadLine());
//Validate height is non-negative
if (height < 0.0)
{
Console.WriteLine(“Feet must be a non-negative value.”);
}

sw.WriteLine(“Height = ” + height);
Console.WriteLine(“nPlease enter the weight in pounds”);
weight = (double)Convert.ToDouble(Console.ReadLine());
//Validate weight is non-negative
if (weight < 0.0)
{
Console.WriteLine(“Weight must be a non-negative value.”);

}
sw.WriteLine(“Weight = ” + weight);
Console.WriteLine(“nPlease enter the age in years”);
age = (int)Convert.ToInt32(Console.ReadLine());
//Validate age is numeric value
if (age <= 0)
{
Console.WriteLine(“Age must be a non-negative value.”);
return;

}
sw.WriteLine(“Age = ” + age);
if (gender == “male” || gender == “MALE”)
{
cal = (66 + (6.3 * Convert.ToDouble(weight)) + (12.9 * Convert.ToDouble(height))) – (6.8 * Convert.ToDouble(age));
//Calculate ideal body weight
idealWeight = (50 + (2.3 * (Convert.ToDouble(height) – 60)));
}
else
{
cal = (655 + (4.3 * Convert.ToDouble(weight)) + (4.7 * ((Convert.ToDouble(height)))) – (4.7 * Convert.ToDouble(age)));
//Calculate ideal body weight
idealWeight = (45.5 + (2.3 * (Convert.ToDouble(height) – 60)));
}
sw.WriteLine(“Daily Recommended calories = ” + cal);
sw.WriteLine(“Ideal Weight = ” + idealWeight);
Console.WriteLine(“nDo you want to enter another patient’s details”);
reply = Console.ReadLine();
} while (reply == “y” || reply == “Y”);

sw.Flush();
sw.Close();
fs.Close();
// Printing message to console
//formatting output

FileStreamfr = newFileStream(“test.txt”, FileMode.Open, FileAccess.Read);

StreamReadersr = newStreamReader(fr);

Console.WriteLine(“==========================================”);
Console.WriteLine(“Sample Calories Calculator:”);
Console.WriteLine(“========================================n”);

sr.BaseStream.Seek(0, SeekOrigin.Begin);

stringstr = sr.ReadLine();

while (str != null)
{

Console.WriteLine(str);

str = sr.ReadLine();

}

Console.WriteLine(“==========================================”);
// wait for user to acknowledge the results
Console.WriteLine(“Press Enter to terminate…”);
Console.Read();

sr.Close();

fs.Close();
return;
}

}

In this exercise you will have both systems analyst and developer roles.

A medium sized hospital, capable of handling a few dozen patients, is to develop diet control software for the patients who are recovering from their illness. In the current scenario the hospital does have software capable of finding the diet requirements for individual patients. However, it is poorly designed. You will be given an application for calculation the recommended daily intake of calories. The application has the following general requirements:

1. The application has formulae for calculating daily recommended calories and the calculation is based on the patient’s personal data and it varies according to the patient’s gender. Here are the formulae:

Male: 66 + (6.3 * body weight in pounds) + (12.9 * height in inches) – (6.8 * age in years)

Female: 655 + (4.3 * weight in pounds) + (4.7 * height in inches) – (4.7 * age in years)

2. The application is also required to calculate an ideal weight which should be based on height and daily calories. The calculation is gender dependent and the formulae are:

Male: 50 + 2.3 kilograms per inch over 5 feet

Female: 45.5 + 2.3 kilograms per inch over 5 feet

3. The next requirement is to save the patient’s historical data so that doctors can track the patient’s progress. Therefore the application needs to capture some data that identifies the patient. A Medicare Number is used for this.

4. Separation of the calculation operation and the operation of persisting patient data. These two actions should be separated to be able to perform some ad hoc calculations without having to input a patient’s name and Medicare number. In addition, users should save data only when they are sure the data is correct.

5. A flat file is used to persist data.

The role of the system analyst is to design and analyse the requirements by drawing a class diagram and sequence diagram for finding the correct dietary intake in calories for a given patient. The developer role is to produce the code. However, in this scenario, you have been given the written code for the application developed by the previous IT team. You are required to refactor the written code and test them based on the analysis and design produced by you as a systems analyst. Finally a report is given to the management about the defects in the design of the existing software by identifying the bad smells etc.

Our Service Charter

1. Professional & Expert Writers

2. Top Quality Papers

3. Plagiarism-Free Papers: 

4. Timely Delivery

5. Affordable Prices

6. 24/7 Customer Support