Ask Software Engineering Expert

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
{
///


///The main entry point for the application.
///


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.

Software Engineering, Computer Science

  • Category:- Software Engineering
  • Reference No.:- M91581210
  • Price:- $120

Guranteed 48 Hours Delivery, In Price:- $120

Have any Question?


Related Questions in Software Engineering

In this assignment you will answer the following questions

In this assignment, you will answer the following questions related to Android platform and Android security design. 1. Describe Android architecture in detail by explaining the four conceptual layers. 2. Describe Androi ...

The research paper for this course is about some of the

The research paper for this course is about some of the best sources of digital evidence for child abuse and exploitation, domestic violence, and gambling according to the National Institute of Justice. Research commerci ...

Research projectin the course we have covered various

RESEARCH PROJECT In the course, we have covered various security and privacy issues that arise in the cyberspace field. We have learned to identify these risks and have discussed the current approaches and developments f ...

Overviewyou are required to modify and logically extend

Overview You are required to modify and logically extend the functionality of a provided code base to implement a game. This requires you to modify the code base as well as create documentation and implement various user ...

Address the following integrating biblical perspectives

Address the following, integrating biblical perspectives where appropriate: Define a hate crime and describe how white supremacist groups use the Internet to spread their message of hate. Explain why hate crime legislati ...

In this assignment you will answer the following review

In this assignment, you will answer the following review questions from the reading materials of the module/week. 1. "What are the key components of a typical P2P application? Describe their functions." 2. "What are the ...

Write reply to this article with references with apa

Write reply to this article with references with APA bibliography. Hate Crimes Over the past couple of years, hate crimes have been on the rise in America's largest cities. Studies show that there were sharp spikes in th ...

Reply to this article with apa referencehate crimes

Reply to this article with APA reference. Hate crimes According to Merriam-Webster, hate crime is any of various crimes (such as assault or defacement of property) when motivated by hostility to the victim as a member of ...

Proposaldesign of an efficient gps tracking system tag for

Proposal Design of an efficient GPS Tracking System (tag) for monitoring small species IMPLEMENTING EMBEDDED SYSTEMS USING SYSML Task Using PapyrusSysML Software (Downloadable online - Evaluation Copy- Latest Version) Mo ...

Write review on this article with apa formatgovernment

Write review on this article with APA format. Government surveillance is a major issue in the United States and globally. Surveillance refers to any collection and processing of personal data, whether, identifiable or no ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As