Questions
Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market,...

Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market, to attract customers as well as meet with their specific needs. Two of the most commonly used accounts are savings and checking. Each of these accounts has various options. For example, you may have a savings account that requires no minimum balance but has a lower interest rate. Similarly, you may have a checking account that limits the number of checks you may write. Another type of account that is used to save money for the long term is certificate of deposit (CD). In this programming exercise, you use abstract classes and pure virtual functions to design classes to manipulate various types of accounts. For simplicity, assume that the bank offers three types of accounts: savings, checking, and certificate of deposit, as described next. Savings accounts: Suppose that the bank offers two types of savings accounts: one that has no minimum balance and a lower interest rate and another that requires a minimum balance and has a higher interest rate. Checking accounts: Suppose that the bank offers three types of checking accounts: one with a monthly service charge, limited check writing, no minimum balance, and no interest; another with no monthly service charge, a minimum balance requirement, unlimited check writing and lower interest; and a third with no monthly service charge, a higher minimum requirement, a higher interest rate, and unlimited check writing. Certificate of deposit (CD): In an account of this type, money is left for some time, and these accounts draw higher interest rates than savings or checking accounts. Suppose that you purchase a CD for six months. Then we say that the CD will mature in six months. Penalty for early withdrawal is stiff. serviceChargeChecking: A service charge checking account is a checking account. Therefore, it inherits all the properties of a checking account. For simplicity, assume that this type of account does not pay any interest, allows the account holder to write a limited number of checks each month, and does not require any minimum balance. Include appropriate named constants, instance variables, and functions in this class. noServiceChargeChecking: A checking account with no monthly service charge is a checking account. Therefore, it inherits all the properties of a checking account. Furthermore, this type of account pays interest, allows the account holder to write checks, and requires a minimum balance. highInterestChecking: A checking account with high interest is a checking account with no monthly service charge. Therefore, it inherits all the properties of a no service charge checking account. Furthermore, this type of account pays higher interest and requires a higher minimum balance than the no service charge checking account. savingsAccount: A savings account is a bank account. Therefore, it inherits all the properties of a bank account. Furthermore, a savings account also pays interest. highInterestSavings: A high-interest savings account is a savings account. Therefore, it inherits all the properties of a savings account. It also requires a minimum balance. certificateOfDeposit: A certificate of deposit account is a bank account. Therefore, it inherits all the properties of a bank account. In addition, it has instance variables to store the number of CD maturity months, interest rate, and the current CD month. Write the definitions of the classes described in this programming exercise and a program to test your classes.

In: Computer Science

HIT 251 CODING PRACTICUM (MEDICINE SECTION ENCOUNTERS) What are the CPT and ICD-10-CM codes? Date of...

HIT 251 CODING PRACTICUM (MEDICINE SECTION ENCOUNTERS)

What are the CPT and ICD-10-CM codes?

Date of Exam: 3/16/2012

Time of Exam: 3:20:41 PM

Patient Name: Smith, Anna Anna shows minimal treatment response as of today. Anna continues to exhibit symptoms of a generalized anxiety disorder. Symptoms continue the same in frequency and intensity, and no significant improvement is noted. Symptoms of this disorder occur more days than not. Sleep difficulty continues unchanged. Feelings of increased muscular tension across neck and shoulders continue unchanged. Anna describes feeling irritable. Continuing difficulty concentrating is described. Feelings of fatigue are described as continuing unchanged. Medication has been taken regularly. She has to force herself to socialize with others. A fair night's sleep is described. Sleep was not continuous and not completely restful. Content of Therapy: Anna admitted to feeling overwhelmed and anxious even when completing the smallest project. Becoming easily frustrated was also discussed by the patient. "When will this jumpiness end?" Therapeutic Interventions: The main therapeutic techniques used this session involved helping to identify areas of difficulty and to develop coping skills and to manage stress. This session the therapeutic focus was on improving the patient's self-compassion. Patient will make positive statements regarding self and the ability to cope with the stresses of life. MENTAL STATUS: Anna is irritable, distracted, and fully communicative, casually groomed, and appears anxious. She exhibits speech that is normal in rate, volume, and articulation and is coherent and spontaneous. Language skills are intact. Mood is entirely normal with no signs of depression or mood elevation. Her affect is congruent with mood. There are no signs of hallucinations, delusions, bizarre behaviors, or other indicators of psychotic process. Associations are intact, thinking is logical, and thought content is appropriate. Homicidal ideas or intentions are convincingly denied. Cognitive functioning and fund of knowledge is intact and age appropriate. Short and long term memory is intact, as is ability to abstract and do arithmetic calculations. This patient is fully oriented. Clinically, IQ appears to be in the above average range. Insight into illness is fair. Social judgment is intact. There are signs of anxiety. Anna is fidgety.

DIAGNOSES: Axis I: Generalized Anxiety Disorder (Active) Medicine 016

INSTRUCTIONS / RECOMMENDATIONS / PLAN: Link to Treatment Plan Problem: Anxiety Short Term Goals: Anna will have anxiety symptoms less than 50% of the time for one month. Target Date: 4/25/2012 In addition, Anna will exhibit increased self-confidence as reported by client on a selfreport 0-10 scale weekly for two months. Target Date: 5/23/2012 ---------------------- No progress in reaching these goals or resolving problems was apparent today. Recommend continuing the current intervention and short term goals. It is felt that more time is needed for the intervention to work. Return 1-2 weeks or earlier if needed. Time spent providing psychotherapy services: 45 min Session start: 2:00 PM Session end: 2:50 PM Liz Lobao, MD

In: Nursing

6. Which is the best statement about the way economists study the aboriginal economy? a.They study...

6. Which is the best statement about the way economists study the aboriginal economy?
a.They study the past, but do not try to predict the future.
b.They use a probabilistic approach based on correlations between economic events.
c.They devise theories, collect data, and then analyze the data to test the theories.
d.They use controlled experiments much the same way a biologist or physicist does.

7. What is a common thread between aboriginal economics and other sciences such as physics?
a.Experiments are most often conducted in a lab.
b.Real-world observations often lead to theories.
c.A Ph.D. is required to truly understand any science.
d.Both deal primarily with abstract concepts.

8. Why is the use of theory and observation more difficult in aboriginal economics than in sciences such as physics?
a.due to the difficulty in evaluating an aboriginal economic experiment
b.due to the difficulty in devising an aboriginal economic experiment
c.due to the difficulty in actually performing an experiment in an aboriginal economic system
d.due to the difficulty in collecting sufficient data

9. Because it is difficult for aboriginal economists to use experiments to generate data, what must they generally do?
a.do without aboriginal data
b.use whatever aboriginal data the world gives them
c.select a committee of aboriginal economists to make up data for all aboriginal economists to use
d.use hypothetical, computer-generated aboriginal data

10. When studying the effects of public policy changes, what have aboriginal economists often observed?
a.There is a difference between the long run and short run.
b.Unemployment and inflation are directly related in the short run.
c.With stock prices, what goes up must come down.
d.If the policy is well-designed, it will always be effective.
11. Why do aboriginal economists use models?
a.to learn how the aboriginal economy works
b.to make their profession appear more precise
c.to make economics accessible to the public
d.to make sure that all of the details of the economy are included in their analysis

12. Which is the best statement about the roles of aboriginal economists?
a.Aboriginal economists are best viewed as policymakers.
b.Aboriginal economists are best viewed as scientists.
c.In trying to explain the world, aboriginal economists are policymakers; in trying to improve the world, they are scientists.
d.In trying to explain the world, aboriginal economists are scientists; in trying to improve the world, they are policymakers.

13. For aboriginal economists, what are the two types of statements about the world?
a.assumptions and theories
b.true statements and false statements
c.specific statements and general statements
d.positive statements and normative statements

14. Which of the following is an example of a positive statement?
a.Prices in reserve rise when the government provides too much welfare.
b.If welfare payments increase, the world will be a better place.
c.Inflation is more harmful to the aboriginal economy than unemployment.
d.The benefits to the aboriginal economy of improved equity are greater than the costs of reduced efficiency.

15. What does a normative statement regarding aboriginal economies describe?
a.how the aboriginal world was in the past
b.how the aboriginal world is
c.how the aboriginal world will be in the future
d.how the aboriginal world ought to be

In: Economics

What is an Object? Coad and Yourdon - A person or thing through which action, thought, or...

What is an Object?


Coad and Yourdon - A person or thing through which action, thought, or feeling is directed. Anything visible or tangible; a material product or substance.


James Martins – From a very early age, we form concepts. Each concept is a particular idea or understanding we have about our world. These concepts allow us to make sense of and reason about the things in our world. These things in our world. These things to which our concepts apply are called objects.


Grady Booch – A tangible and/or visible thing; something that may be apprehended intellectually; something toward which thought or action is directed. An individual, identifiable item, unit, or entity, either real or abstract, with a well-defined role in the problem domain. Anything with a crisply defined boundary.


Coleman - An object is a thing that can be distinctly identified. At the appropriate level of abstraction almost anything can be considered to be an object. Thus a specific person, organization, machine, or event can be regarded as an object.


OBJECT THINK


The object thinks approaches help us believe that an object in a computer system is like us. Hence to find out about the object, we let it talk about itself

An example is a button on a screen

I am a button on the screen

I know what window I am attached to


I know my position in the window


I know my height and width


I know background color


I know what the label that appears on me says


I know what to do when pushed


Using Object Think in terms of the environment the object is in.

An example is a dog

I am actually a dog

I know people call me Rover


I know people with certain voices and smells regularly feed me.


I know how to eat, sleep, roll over, bark and chase cars


  An example of a dog in the context of a veterinarian’s administrative work


I am a dog object in the work context of a veterinarian

I know my license number, name, breed, birth date and weight


I know the owner I am associated with.


I know the check up results I am associated with


I know my next appointment date and time


I know if my patients’ status is “all paid up” or “payment overdue”


TASK ONE


Identify and name the following objects and identify the work context based on the object think description provided.


             I am a ___________ in the work context of a ____________.


                        I know my title, author, and call number


                        I know how to be checked out.


                        I know how to be returned.


             I am a __________ in the work context of a ____________.


                        I know my title, author, publisher, price and ISBN number


                        I know how to be put on order


                        I know how to be stocked


                        I know how to be sold


                        I know how to be returned


TASK TWO


Use the object think approach to write description for the following


I am actually a car


I am a car object in the work context of a repair shop


I am a car object in the work context of a car collector.


In: Computer Science

Lab 3 Java Classes and Memory Management Multi-file Project In this lab you will gain experience...

Lab 3 Java Classes and Memory Management

Multi-file Project

  1. In this lab you will gain experience using classes and arrays of classes. Use the following as the beginning of a student abstract data type.

public class Student

{

private String fName ;

private String lName ;

private double[] grades;

}

This class should be in the package com.csc241. Write a program that prompts a user for a total number of students and dynamically allocates memory for just that number of Student objects in a Student[]. Then continuously re-prompt the user to enter, on a studentbystudent basis,

  1. a student’s first and last name to be used in populating the class data members fName and lName with appropriate set methods. Use local String variables to hold the values entered by the user.
  2. the number of grades for the student to be stored in nGrds, a local variable of the main program.

Next,

  1. dynamically allocate memory for the grades and assign the resulting reference to a local double[]. Prompt the user for the nGrds values and after acquiring them all, assign the local grades array to the Student instance in the array using an appropriate set method.
  2. re-use the MaxMin class you wrote in a previous lab, but also put it in the package com.csc241. Similarly, the GradeCalculator class that you created in the last assignment needs to be in the com.csc241 package. You will be using the avg and maxMin static methods that accept the grades[] in order to compute individual student statistics.
  3. In order for you to calculate ensemble statistics, that is statistics for the entire class, the GradeCalculator class will need methods avg and maxMin that accept as an argument the Student[] that you dynamically allocated. These methods must loop through the individual grades[] of each Student array element in order to compute the total class average, max and min values.
  4. display the results to the user, both on a per student and ensemble basis. Your output should appear as shown below. Please make note of and reproduce all the decimal formatting and other characteristics of the sample output.

As always, keep in mind all of the general rules of good program construction.

How many students are in your class - 3

Enter the first name of student #1 - Joe

Enter Mike’s last name - Shmo

How many grades will you be entering for Joe Shmo? – 5

Plz enter the grades for Joe Shmo

100

97

87

87

92

Grade Statistics for Joe Shmo (average=92.6 ; max/min=100/87)

Enter the first name of student #2 - Jack

Enter Jack’s last name - Schwartz

How many grades will you be entering for Jack Schwartz? – 3

Plz enter the grades for Jack Schwartz

100

90

0

Grade Statistics for Jack Schwartz (average=63.3 ; max/min=100/0)

Enter the first name of student #3 - Joan

Enter Joan’s last name - Jameson

How many grades will you be entering for Joan Jameson? – 4

Plz enter the grades for Joan Jameson

98

95

93

94

Grade Statistics for Joan Jameson (average=95.0 ; max/min=98/93)

Ensemble Statistics - Average=86.1 ; Max/Min=100/0)

Do you wish to continue (Y/N) - n

In: Computer Science

Implement the minimum priority queue UnsortedMPQ (using vector) that is a child class of the provided...

Implement the minimum priority queue UnsortedMPQ (using vector) that is a child class of the provided MPQ class. The functions from MPQ that are virtual function (remove min(), is empty(), min(), and insert()) must be implemented in the child classes. The functions remove min() and min() should throw an exception if the minimum priority queue is empty.

For the UnsortedMPQ class, you will use a vector to implement the minimum priority queue functions. The insert() function should be O(1) and the remove min() function should be O(n).

Below I will attach the parent class (MPQ.h), child class (unsortedMPQ.h - needs implementation), and unsortedMPQ-main.cpp - for testing and does not need to be implemented.

Please Code in C++.

MPQ.h

#ifndef MPQ_H
#define MPQ_H

//Abstract Minimum Priority Queue Class
template
class MPQ{
public:
virtual T remove_min() = 0;
virtual T min() = 0;
virtual bool is_empty() = 0;
virtual void insert(const T& data) = 0;
};
#endif

unsortedMPQ.h

#ifndef UNSORTEDMPQ_H
#define UNSORTEDMPQ_H

#include
#include
#include "MPQ.h"

/*
* Minimum Priority Queue based on a vector
*/
template
class UnsortedMPQ: MPQ {

};

#endif

unsortedMPQ-main.cpp (for testing)

#include "UnsortedMPQ.h"
#include

using namespace std;

int main() {
{
UnsortedMPQ mpq;
cout << "Inserting 1 - 5" << endl;
mpq.insert(1);
mpq.insert(2);
mpq.insert(3);
mpq.insert(4);
mpq.insert(5);
cout << "Remove min five times" << endl;
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << endl << endl;
}
{
UnsortedMPQ mpq;
cout << "Inserting 5 - 1" << endl;
mpq.insert(5);
mpq.insert(4);
mpq.insert(3);
mpq.insert(2);
mpq.insert(1);
cout << "Remove min five times" << endl;
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << endl << endl;
}
{
UnsortedMPQ mpq;
cout << "Inserting mixed order 1-5" << endl;
mpq.insert(5);
mpq.insert(2);
mpq.insert(4);
mpq.insert(3);
mpq.insert(1);
cout << "Remove min five times" << endl;
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << endl << endl;
}
{
UnsortedMPQ mpq;
cout << "Testing exception" << endl;
try {
mpq.remove_min();
}
catch (exception& e) {
cout << e.what() << endl;
}
cout << endl;
}
{
UnsortedMPQ mpq;
cout << "Inserting mixed order 1-5" << endl;
mpq.insert(5);
mpq.insert(2);
mpq.insert(4);
mpq.insert(3);
mpq.insert(1);
cout << "Remove min five times" << endl;
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << endl;
cout << "Inserting mixed order 11-15" << endl;
mpq.insert(15);
mpq.insert(12);
mpq.insert(14);
mpq.insert(13);
mpq.insert(11);
cout << "Remove min five times" << endl;
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << ", ";
cout << mpq.remove_min() << endl;
cout << "Testing exception" << endl;
try {
mpq.remove_min();
}
catch (exception& e) {
cout << e.what() << endl;
}
}
return 0;
}

In: Computer Science

Define the class HotelRoom. The class has the following private data members: the room number (an...

Define the class HotelRoom. The class has the following private data members: the room number (an integer) and daily rate (a double). Include a default constructor as well as a constructor with two parameters to initialize the room number and the room’s daily rate. The class should have get/set functions for all its private data members [20pts]. The constructors and the get/set functions must throw an invalid_argument exception if either one of the parameter values are negative. The exception handler should display the message “Negative Parameter” [20pts]. Include a toString() function that nicely formats and returns a string that displays the information about the hotel room [10pts].

  1. Write a main function to test the class HotelRoom, create a HotelRoom object. Try to set the room rate to an invalid value to generate an exception. Invoke the toSting() function to display the HotelRoom object. [20pts]
  2. Derive the classes GuestRoom form the base class HotelRoom. The GuestRoom has private data fields and public functions:
    1. The private data field capacity (an Integer) that represents the maximum number of guests that can occupy the room. [5pts]
    2. The private data member status (an integer), which represents the number of guests in the room (0 if unoccupied). [5pts]
    3. An integer data field days that represents the number of days the guests occupies the room. [5pts]
    4. Add constructors and get/set functions to the GuestRoom class. The set function for the status data member must throw an out_of_range exception if it tries to set status to value greater than the capacity. [30pts]
    5. The function calculateBill() that returns the amount of guest’s bill. [10pts]
    6. Redefine the function toString() that formats and returns a string containing all pertinent information about the GuestRoom. [15pts]
  3. Derive the classes MeetingRoom form the base class HotelRoom. The class has the following private data filed sand public functions:
    1. A private data field seats, which represents the number of seats in the room. [5pts]
    2. An integer data field status (1 if the room is booked and 0 otherwise). [5pts]
    3. Add constructors and get/set functions to the GuestRoom class. [10pts]
    4. Redefine the function toSting() to format and return a string containing all pertinent information about the MeetingRoom. [20pts]
    5. The function CalculateBill(), which returns the amount of the bill for renting the room for one day. The function calculates the bill as follows: the number of seats multiplied by 10.00, plus 500.00. [20pts]
  4. Write a main function to test the classes GuestRoom and MeetingRoom. Invoke the calculateBills and toStirng() in each of the objects. [40pts]]
  5. Make changes to the HotelRoom class to implement polymorphism. Add a virtual function calculateBill() that returns 0.00 and make the toString() function in the HotelRoom class a virtual function. Write the function displayHotelRoom() that receive a base class type reference as a parameter, then invokes the functions calculateBill() and toString(). The function must return void. [50pts]
  6. From the main function invoke the function displayHotelRoom() three separate times and each time send a HotelRoom, a GuestRoom, and a MeetingRoom type objects. [20pts]

  7. Repeat parts e and f but make appropriate changes in such a way that HotelRoom is turned into an abstract base class. [50pts]

In: Computer Science

Requirements:   You are to write a class called Point – this will represent a geometric point...

Requirements:   You are to write a class called Point – this will represent a geometric point in a Cartesian plane (but x and y should be ints).   Point should have the following:

Data:  

  • that hold the x-value and the y-value. They should be ints and must be private.

Constructors:

  • A default constructor that will set the values to (2,-7)
  • A parameterized constructor that will receive 2 ints (x then y) and set the data to what is received.
  • A copy constructor that will receive a Point. If it receives null, then it should

throw new IllegalArgumentException(<”your meaningful String here”>);

If it is OK, the it should initialize the data (of the new instance being created) to be the same as the Point that was received.

Methods:

  • The methods to be implemented are shown in the PointInterface.java. You can look at this file to see the requirements for the methods.
  • Your Point class should be defined like this:

public class Point implements PointInterface

When your Point.java compiles, Java will expect all methods in the interface to be implemented and will give a compiler error if they are missing. The compiler error will read “class Point is not abstract and does not implement method ”.

You can actually copy the PointInterface methods definitions into your Point class so it will have the comments and the method headers.   If you do this, be sure to take out the ; in the method headers or you will get a “missing method body” syntax error when compiling…

  • But a toString() method and a .equals(Object obj) method are automatically inherited from the Object class. So if you do not implement them, Java will find and use the inherited ones – and will not give a compiler error (but the inherited ones will give the wrong results). The Point class should have its own .toString and .equals methods.
  • ==============================================================================
  • This is the interface (called PointInterface.Java) for a Point class (which will represent a 2-dimensional Point)
  • public interface PointInterface

    {

    // toString

    // returns a String representing this instance in the form (x,y)

    (WITHOUT a space after the ,)

    public String toString();

    // distanceTo

    // throws a new IllegalArgumentException(

    if null is received

    // returns the distance from this Point to the Point that was

    received

    // NOTE: there is a static method in the Math class called hypot

    can be useful for this method

    public double distanceTo(Point otherPoint);

    //equals - returns true if it is equal to what is received (as an Object)

    public boolean equals(Object obj);

    // inQuadrant

    // returns true if this Point is in the quadrant specified

    // throws a new IllegalArgumentException if the quadrant is

    out of range (not 1-4)

    public boolean inQuadrant(int quadrant);

    // translate

    // changes this Point's x and y value by the what is received (thus

    "translating" it)

    // returns nothing

    public void translate(int xMove, int yMove);

    // onXAxis

    // returns true if this Point is on the x-axis

    public boolean onXAxis();

    // onYAxis

    // returns true if this Point is to the on the y-axis

    public boolean onYAxis();

    //=============================================

    // The method definitions below are commented out and

    // do NOT have to be implemented

    // //===========================================

    // halfwayTo

    // throws a new IllegalArgumentException(

    if null is received

    // returns a new Point which is halfway to the Point that is

    received

    //public Point halfwayTo(Point another);

    // slopeTo

    // throws a new IllegalArgumentException(

    if null is received

    // returns the slope between this Point and the one that is

    received.

    // since the slope is (changeInY/changeInX), then first check to see if

    changeInX is 0

    // if so, then return Double.POSITIVE_INFINITY; (since the

    denominator is 0)

    //public double slopeTo(Point anotherPoint)

    }

In: Computer Science

Requirements:   You are to write a class called Point – this will represent a geometric point...

Requirements:   You are to write a class called Point – this will represent a geometric point in a Cartesian plane (but x and y should be ints).   Point should have the following:

Data:  

  • that hold the x-value and the y-value. They should be ints and must be private.

Constructors:

  • A default constructor that will set the values to (2,-7)

  • A parameterized constructor that will receive 2 ints (x then y) and set the data to what is received.
  • A copy constructor that will receive a Point. If it receives null, then it should

throw new IllegalArgumentException(<”your meaningful String here”>);

If it is OK, the it should initialize the data (of the new instance being created) to be the same as the Point that was received.

Methods:

  • The methods to be implemented are shown in the PointInterface.java. You can look at this file to see the requirements for the methods.

  • Your Point class should be defined like this:

public class Point implements PointInterface

When your Point.java compiles, Java will expect all methods in the interface to be implemented and will give a compiler error if they are missing. The compiler error will read “class Point is not abstract and does not implement method ”.

You can actually copy the PointInterface methods definitions into your Point class so it will have the comments and the method headers.   If you do this, be sure to take out the ; in the method headers or you will get a “missing method body” syntax error when compiling…

  • But a toString() method and a .equals(Object obj) method are automatically inherited from the Object class. So if you do not implement them, Java will find and use the inherited ones – and will not give a compiler error (but the inherited ones will give the wrong results). The Point class should have its own .toString and .equals methods.
  • ==============================================================================
  • This is the interface (called PointInterface.Java) for a Point class (which will represent a 2-dimensional Point)
  • public interface PointInterface

    {

    // toString

    // returns a String representing this instance in the form (x,y)

    (WITHOUT a space after the ,)

    public String toString();

    // distanceTo

    // throws a new IllegalArgumentException(

    if null is received

    // returns the distance from this Point to the Point that was

    received

    // NOTE: there is a static method in the Math class called hypot

    can be useful for this method

    public double distanceTo(Point otherPoint);

    //equals - returns true if it is equal to what is received (as an Object)

    public boolean equals(Object obj);

    // inQuadrant

    // returns true if this Point is in the quadrant specified

    // throws a new IllegalArgumentException if the quadrant is

    out of range (not 1-4)

    public boolean inQuadrant(int quadrant);

    // translate

    // changes this Point's x and y value by the what is received (thus

    "translating" it)

    // returns nothing

    public void translate(int xMove, int yMove);

    // onXAxis

    // returns true if this Point is on the x-axis

    public boolean onXAxis();

    // onYAxis

    // returns true if this Point is to the on the y-axis

    public boolean onYAxis();

    //=============================================

    // The method definitions below are commented out and

    // do NOT have to be implemented

    // //===========================================

    // halfwayTo

    // throws a new IllegalArgumentException(

    if null is received

    // returns a new Point which is halfway to the Point that is

    received

    //public Point halfwayTo(Point another);

    // slopeTo

    // throws a new IllegalArgumentException(

    if null is received

    // returns the slope between this Point and the one that is

    received.

    // since the slope is (changeInY/changeInX), then first check to see if

    changeInX is 0

    // if so, then return Double.POSITIVE_INFINITY; (since the

    denominator is 0)

    //public double slopeTo(Point anotherPoint)

    }

In: Computer Science

In C++, please include main Goals  Identify requirements for a program using polymorphism  Create...

In C++, please include main

Goals

 Identify requirements for a program using polymorphism

 Create a program to demonstrate your class hierarchy

Requirements

In this project, you will create a simple class hierarchy as the basis for a fantasy combat game. Your ‘universe’ contains Vampires, Barbarians, Blue Men, Medusa and Harry Potter. Each has characteristics for attack, defense, armor, and strength points as follows. Type

Attack

Defense

Armor

Strength Points

Vampire1

1d12

1d6* Charm

1

18

Barbarian2

2d6

2d6

0

12


1. Suave, debonair, but vicious and surprisingly resilient!

2. Think Conan or Hercules from the movies. Big sword, big muscles, bare torso.

“3d6” is rolling three 6-sided dice, “2d10” is rolling two 10-sided dice, etc.

NOTE: The sample creatures are unbalanced intentionally. This will help you in debugging your program! Some will win a lot, and others will lose a lot.

To resolve an attack, you will need to generate 2 dice rolls. The attacker rolls the appropriate number and type of dice under Attack. The defender rolls the appropriate number and type of dice under Defense. You will subtract the Defense roll from the Attack roll. That is the damage to the defender.

Each class only has its own information or data. When O1 is fighting O2, your program should call O1’s attack function. It will return the damage inflicted. Then O2’s defense function will take the damage inflicted, roll the specified dice and subtract the damage points from the defense. To apply the damage, you subtract the Armor value. The result is then subtracted from the Strength Points. That value becomes the new Strength Points for the next round. If Strength Points goes to 0 or less, then the character is out of the combat. For example, if one object receives 9 points of damage and rolls 3 for its defense, and has an armor of 4 and strength point of 8, it would take 9 subtract 3, and then 4 for the armor, to receive 2 points of damage, and its new strength point will be 8-2=6.

Start with the base and Barbarian classes.

You need to create a Creature base class. Then you will have a subclass for each of these characters. Note that the Creature class will be an abstract class. For our purposes right now, each subclass will vary only in the values in the table. It is part of your design task to determine what functions you will need.

To play the game, write a menu. Display two fighters by their names and prompt the user to select two fighters to fight one another. Students must account for two fighters of the same type. Randomly select one fighter to attack first. The fighters will take turns fighting each other until one's Strength point is zero or negative. (You do not have to display results of each round of fighting, but you can do that for the purpose of debugging.) Then display the winning fighter to the screen. Ask users to play again or exit the game. This is the first stage of a larger project. Please do not add any creatures of your own.

In: Computer Science