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 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
In: Economics
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
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,
Next,
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 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 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].
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]
In: Computer Science
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:
Constructors:
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:
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…
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 in a Cartesian plane (but x and y should be ints). Point should have the following:
Data:
Constructors:
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:
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…
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 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