Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Hotdogs The Worlds Greatest Cost Effective Wholesome Nutritious Food Due to world food supply scarcity and the burgeoning populations of the worlds countries, your

Java

Hotdogs The Worlds Greatest Cost Effective Wholesome Nutritious Food

Due to world food supply scarcity and the burgeoning populations of the worlds countries, your hot stand business is globalizing to satisfy the worlds desire for a cost effective wholesome nutritious food source. Market studies have shown that tens of billions of people are craving for the eponymous hot dog which will result in a huge number of hotdog sales from hotdog stands. You need to develop a program that tracks the activities of all the hotdog stands. You operate hotdog stands throughout the world, well, maybe, except for North Korea and the artics.

You must use the following package name for developing the java program: package hotdogstandpackage;

There must be at least 2 java source code files that have the following names: ? HotDogStandMainClass.java Contains the public HotDogStandMainClass. Contains the HotDogStandClass.

The program must create and use at least three hot dog stand objects. If you do not use the above file names, class names and package name, the assignment is an invalid submission and will be graded a 0%.

HotDogStandMainClass Define a class named HotDogStandMainClass. The HotDogStandClass Class must include the following methods ? A main() method Write a main method test driver class, a concept that is demonstrated in the book, to test HotdogStandClass class. The main method test driver must test all paths of the logic flow and conditions of the program to validate program correctness. Do not use JPanel or interactive prompts, unit test the HotdogStandClass by coding in test scenarios in the main program which will act as a test driver. The main unit test driver must display information that indicates what is being tested with the test values being used, and display a result output of the test. The output must be well formatted and readable to the user running the program. The main test unit driver does not have to output if the test passed or failed, just the test values used for each test and the result.

You will lose points if the main method class does not do comprehensive path testing of the program. This class has the following for private class member variables: ? static Hotdogs sold total for all stands Total number of hot dogs sold by all hot dog stands Define a class named HotDogStandClass. This class has the following for private member instance variables: ? Hotdog stand Identification Each stand should have a unique identification ? Stand Location A string that is the address of the stand which includes street, city and country. For examples: 12 Deepika Padukone Ci, Bangelore, Karnataka 67089, India 1038 West Nanjing Road, Westgate Mall, 8th Floor, Shanghai, Shanghai 200041, China ? Hot Dog Cost Cost cannot be negative, the cost must 0 or greater expressed in US currency with cents. Zero may be used for promotional sale days. ? Hotdogs Inventory Amount The lowest value the inventory can be is 0. Negative inventory amounts do not make sense. ? Hotdogs Sold Count How many hot dogs the stand has sold since the program was started. The HotDogStandClass Class must include the following methods ? A constructor ? Accessor (Getter) and Setter methods for all member instance variables ? HotDogsBuy method ? The method will be invoked each time someone (your main method test driver) wants to buy some hotdog(s). ? Has a parameter that indicates the requested amount of hotdogs to be bought ? If the inventory is 0, the method should display a message that there are no more hotdogs left to be sold. The method uses the amount of the hot dogs requested to: ? Increase the hog dogs total for all the stands by the parameter amount ? Increase tracked hot dogs sold ? Decrease the hot dog inventory ? This method should be intelligent regarding the inventory. The lowest value the inventory can be is 0. Negative inventory amounts does not make sense. If the buy amount is more than the inventory, the class should state the amount of hotdogs in inventory and state to retry a buy. ? stockInventory method that is used to add inventory ? Has a parameter that indicates the requested amount of hotdogs to be bought

Test Driver example i found online

As referenced from here:

What is a driver class? (Java)

A "Driver class" is often just the class that contains a main. In a real project, you may often have numerous "Driver classes" for testing and whatnot, or you can build a main into any of your objects and select the runnable class through your IDE, or by simply specifying "java classname."

Example:

This is not a driver class since it doesn't contain any main method. In this case, it has the method "hello":

 public class HelloWorld { public void hello() { System.out.println("Hello, world!"); } }

versus this one - which is a driver class since it contains a main method, and is the class that runsHelloWorld:

 public class HelloWorldDriver { public static void main(String[] args) { HelloWorld sayhello = new HelloWorld(); sayhello.hello(); } }

Hence the name "driver class" - as the class HelloWorldDriver "drives" or rather, controls the instantiation and usage of the class HelloWorld.

and from the book about testing methods

The book itself just says this about test driver: " Each method should be test in a program in which it is the only untested program. If you test methods this way, then when you find an error, you will know which method contains the error. A program that does nothing but test a method is called a driver program.

If one method contains an invocation of another method in the same class, this can compicate the testing task. One way to test a method is to first test all the methods invoked by that method and then test the method itself. This is called bottom-up testing.

It is sometimes impossible or inconvenient to test a method without using some other method tahat has not yet been written or has not yet been tested. In this case, you can use a simplified version of the missing or untested method. These simplified methods are called stubs. These stubs will not neccessarily perform the correct calculation, but they will deliver values suffice for testing, and they are siple enough that you can have confidence in their performance. For example, the following is a possible stub:

//**

Computes the probability of rain based on temperature, barometric pressure, and relative humidity. Returns the probability as a fraction between 0 and 1.

*/

public double rainChance (double temperature, double pressure, double humidity)

{

return 0.5; //Not correct but good enough for a stub.

}

The Fundemental Rule for Testing Methods

Every method should be testen in a program in which every other method in the testing program has already been fully tested and debugged.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is an interface? What keyword is used to define one?

Answered: 1 week ago

Question

2. Describe how technology can impact intercultural interaction.

Answered: 1 week ago