Create a class diagram in enterprise architect

Assignment Help Software Engineering
Reference no: EM13907278

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.

Reference no: EM13907278

Questions Cloud

Calculate the exercise value of firms warrants : Calculate the exercise value of the firm's warrants if the common sells at each of the following prices: Assume the firm's stock now sells for $20 per share. The company wants to sell some 20-year, $1,000 par value bonds with interest paid annually. ..
How many milliliters of 0.200 m naoh : How many milliliters of 0.200 M NaOH are required to neutralize 70.0 mL of 0.250 M H2SO4? The balanced neutralization reaction is:H2SO4(aq)+2NaOH(aq)→Na2SO4(aq)+2H2O(l).
Healthcare reform and long term care : Healthcare Reform and Long Term Care
What did ge do correctly and what are the key lessons here : By most reports, GE's ecomagination strategy has been successfully implemented. Why do you think this is the case? What did GE do correctly? What are the key lessons here?
Create a class diagram in enterprise architect : Create a class diagram in Enterprise Architect which fully represents the classes above and the relationships between them and create a NUnit test class for the Customer class and fully test all of the methods. Include an appropriate setup function ..
Titration of a 11.0 ml solution of koh requires 11.0 ml : Titration of a 11.0 mL solution of KOH requires 11.0 mL of 0.0270M H2SO4 solution. What is the molarity of the KOH solution?
What is the implicit interest in dollars : A zero coupon bond with a face value of $1,000 is issued with an initial price of $507.96. The bond matures in 18 years. What is the implicit interest, in dollars, for the first year of the bond's life? Use semiannual compounding.
Purpose of calea : The purpose of CALEA is __________. As Americans become increasingly concentrated in urban centers, police will be called on to referee more disputes between __________
Find the analyte concentration in the liquid phase : Thermodynamic equilibrium constant K for liquid-gas partitioning is a ratio of the analyte concentration in liquid phase to its concentration in gas phase. For some closed system with 10 mL of liquid phase volume and 20 mL of gas phase volume the ana..

Reviews

Write a Review

Software Engineering Questions & Answers

  Creating a modularized body mass index program

Create a modularized Body Mass Index (BMI) Program which will compute the BMI of a team player.

  Question short1compare and contrast the ideas of semantic

question short1compare and contrast the ideas of semantic complexity and structural complexity of a computer program.

  Question about hippa rights

I have found that to date, the largest offense is looking into family records even though workers are warned not too and that this is a violation of that family member's HIPAA's rights.

  Create plan for converting shareware version to full version

Create the plan for converting shareware version to full version without paying one cent. If it is not possible for shareware to be converted to full version

  Explain and justify the need for good hci practice

Explain and justify the need for good HCI practice and discuss the role of cognitive psychology in the design of user interfaces.

  Finding error in code sequence

This code prints all elements of the array geo for, Describe what the problems are and how to fix them.

  Draw erd for database that track baluster design

Draw an ERD for a database that should track baluster designs, balusters sold, and customer orders for a company that sells various wood balusters.

  Describe the application architecture and process design

Describe the application architecture and process design. Include a high-level description of the security controls you recommend for the design of this HR system.

  Draw e-r diagram for courses offered by college

Prerequisite for any number of courses, or may not be prerequisite for any other course. Draw an E-R diagram for this situation. Clearly state the assumptions made.

  Assignment on information technology

As the grading for the Current Events Ethics Analysis Assignment is criterion-based, you need to carefully read the assignment description (quoted below) and follow it like a checklist to make sure you address all assignment criteria.

  Question related to inheritance

Inheritance is a method in object oriented programming in which you derive new classes from existing classes in your code. Explain why might this be useful?

  Create a tentative list of requirements for the proposed

create a tentative list of requirements for the proposed system. possible solution that could meet the business

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