Questions
my question hasnt been answered yet. So, posting it again. Follow program instructions carefully. spacing is...

my question hasnt been answered yet. So, posting it again.

Follow program instructions carefully. spacing is important.

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 <the missing 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.

Piece of the code:

//This is the interface 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(<your descriptive String> 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(<your descriptive String> 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(<your descriptive String> 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

When you are developing and implementing a network, one of the primary concerns is controlling and...

When you are developing and implementing a network, one of the primary concerns is controlling and monitoring traffic through the network. How can you effectively utilize a firewall on the network? Also, software vs. hardware - what are the advantages and disadvantages of each?

In: Computer Science

Design a security service that provides data integrity, data confidentiality and nonrepudiation using public-key cryptography in...

Design a security service that provides data integrity, data confidentiality and nonrepudiation using public-key cryptography in a two-party communication system over an insecure channel.

In: Computer Science

DO NOT ANSWER THIS QUESTION[Write a program that the owner of Chica Chic could use to...

DO NOT ANSWER THIS QUESTION[Write a program that the owner of Chica Chic could use to store data about her inventory in a text file. The program should prompt her to input the name, cost price, and quantity of each item of inventory. Each of these three data has to be written to its own line in the file. The program should loop to enable any number of inventory items to be stored and end when the item name is left blank (see Sample Output. User inputs are shown in blue). The program should end by closing the file and printing a file status message. Sample Output Enter the name of the inventory item or ENTER to quit tops Enter the cost price of this item 24.99 Enter the quantity in stock of this item 10 A record was written to file Enter the name of the inventory item or ENTER to quit shorts Enter the cost price of this item 29.95 Enter the quantity in stock of this item 12 A record was written to file Enter the name of the inventory item or ENTER to quit sandals Enter the cost price of this item 19.79 Enter the quantity in stock of this item 8 A record was written to file Enter the name of the inventory item or ENTER to quit The file was created successfully and closed] DO NOT ANSWER THIS QUESTON

Now write another program that reads her inventory file, displays all data for each item, and reports on the inventory value. The cost value of each item and the cost value of the total inventory should be reported. Strive to duplicate the Sample Output below.
Sample Output
Chica Chic Inventory

tops, $24.99 each, 10 in stock, value $249.90
shorts, $29.95 each, 12 in stock, value $359.40
sandals, $19.79 each, 8 in stock, value $158.32
End of file
Total inventory value $767.62

In: Computer Science

Online Store Simulator cpp files needed hpp files provided You will be writing a (rather primitive)...

Online Store Simulator cpp files needed hpp files provided

You will be writing a (rather primitive) online store simulator. It will have three classes: Product, Customer and Store. To make things a little simpler for you, I am supplying you with the three .hpp files. You will write the three implementation files. You should not alter the provided .hpp files.

Here are the .hpp files: Product.hpp, Customer.hpp and Store.hpp three files are below the questions;

Here are descriptions of methods for the three classes:

Product:

A Product object represents a product with an ID code, title, description, price and quantity available.

constructor - takes as parameters five values with which to initialize the Product's idCode, title, description, price, and quantity available

get methods - return the value of the corresponding data member

decreaseQuantity - decreases the quantity available by one

Customer:

A Customer object represents a customer with a name and account ID. Customers must be members of the Store to make a purchase. Premium members get free shipping.

constructor - takes as parameters three values with which to initialize the Customer's name, account ID, and whether the customer is a premium member

get methods - return the value of the corresponding data member

isPremiumMember - returns whether the customer is a premium member

addProductToCart - adds the product ID code to the Customer's cart

emptyCart - empties the Customer's cart

Store:

A Store object represents a store, which has some number of products in its inventory and some number of customers as members.

addProduct - adds a product to the inventory

addMember - adds a customer to the members

getProductFromID - returns product with matching ID. Returns NULL if no matching ID is found.

getMemberFromID - returns customer with matching ID. Returns NULL if no matching ID is found.

productSearch - for every product whose title or description contains the search string, prints out that product's title, ID code, price and description

addProductToMemberCart - If the product isn't found in the inventory, print "Product #[idCode goes here] not found." If the member isn't found in the members, print "Member #[accountID goes here] not found." If both are found and the product is still available, calls the member's addProductToCart method. Otherwise it prints "Sorry, product #[idCode goes here] is currently out of stock." The same product can be added multiple times if the customer wants more than one of something.

checkOut - If the member isn't found in the members, print 'Member #[accountID goes here] not found.' Otherwise prints out the title and price for each product in the cart and decreases the available quantity of that product by 1. If any product has already sold out, then on that line it should print 'Sorry, product #[idCode goes here], "[product name goes here]", is no longer available.' At the bottom it should print out the subtotal for the cart, the shipping cost ($0 for premium members, 7% of the cart cost for normal members), and the final total cost for the cart (subtotal plus shipping). If the cart is empty, it should just print "There are no items in the cart." When the calculations are complete, the member's cart should be emptied.

Here is an example of how the output of the Store::productSearch method might look (searching for "red"):

red blender
ID code: 123
price: $350
sturdy blender perfect for making smoothies and sauces

hot air balloon
ID code: 345
price: $700
fly into the sky in your own balloon - comes in red, blue or chartreuse


Here is an example of how the output of the Store::checkOutMember method might look:

giant robot - $7000
Sorry, product #345, "live goat", is no longer available.
oak and glass coffee table - $250
Subtotal: $7250
Shipping Cost: $0
Total: $7250

In the main method you use for testing, you should only need to #include Store.hpp. Remember that your compile command needs to list all of the .cpp files.

customer.hpp

#ifndef CUSTOMER_HPP
#define CUSTOMER_HPP

#include
#include "Product.hpp"

class Customer
{
private:
std::vector cart;
std::string name;
std::string accountID;
bool premiumMember;
public:
Customer(std::string n, std::string a, bool pm);
std::string getAccountID();
std::vector getCart();
void addProductToCart(std::string);
bool isPremiumMember();
void emptyCart();
};

#endif

product.hpp

#ifndef PRODUCT_HPP
#define PRODUCT_HPP

#include

class Product
{
private:
std::string idCode;
std::string title;
std::string description;
double price;
int quantityAvailable;
public:
Product(std::string id, std::string t, std::string d, double p, int qa);
std::string getIdCode();
std::string getTitle();
std::string getDescription();
double getPrice();
int getQuantityAvailable();
void decreaseQuantity();
};

#endif

store.hpp

#ifndef STORE_HPP
#define STORE_HPP

#include
#include "Customer.hpp"

class Store
{
private:
std::vector inventory;
std::vector members;
public:
void addProduct(Product* p);
void addMember(Customer* c);
Product* getProductFromID(std::string);
Customer* getMemberFromID(std::string);
void productSearch(std::string str);
void addProductToMemberCart(std::string pID, std::string mID);
void checkOutMember(std::string mID);
};

#endif

In: Computer Science

In writing integers to a file you need to connect 2 streams together to accomplish this...

In writing integers to a file you need to connect 2 streams together to accomplish this task. Below show the code you might use to connect 2 stream classes together. (Use a FileOutputStream and a DataOutputStream)

In: Computer Science

Write a program that calculates the student's final grade for a test with 20 multiple questions...

Write a program that calculates the student's final grade for a test with 20 multiple questions using C# .net Framework.

se an array of integers to store the test scores (0-incorrect answer, 1-correct answer). Initialize it as follows:

int [] scores = {1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1};

3. If the student answered the question right, add 5 points to the running total. If the student didn’t answer correctly subtract .5 points from the running total.

4. The running total is initialized with 5 points (so the student receives 5 points extra credit).

5. To define the final grade use the grading scale below

Score

Grade

90+

A

80-89

B

70-79

C

60-69

D

<60

F

6. Write a helper method displayScoreGrade()that displays the score and calculated grade.

     private static void displayGrade(double score, char grade){

        //printing the score;

        //printing the grade;

        ...         

     }

  Call the method from the main method.

In: Computer Science

1. Create a1. Create a new java file named Name.java that should have Name class based...

1. Create a1. Create a new java file named Name.java that should have Name class based on new java file named Name.java that should have Name class based on the following UML

Name

- first: String

- last: String

+ Name ()

+ Name (String firstName, String lastName)

+ getName () : String

+ setName (String firstName, String lastName) : void

+ getFirst () : String

+ setFirst (String firstName) : void

+ getLast () : String

+ setLast (String lastName) : void

+ printName () : void

Notes: Name() constructor should call the other constructor to set blank values for first and last variables; getName should call getFirst and getLast; setName should call setFirst and setLast; printName should call getName and then print the name in the following format (assuming that values of Rahul & Dewan were used to create the Name object) – Hello Rahul Dewan, Welcome to CIS1500 Course ! If the name is blank, it should display message like: Name is blank !

In: Computer Science

In this task you will implement a C++ function with arguments: a sorted integer array, size...

In this task you will implement a C++ function with arguments: a sorted integer array, size of the array, and a target integer value. Find all combinations of two elements in the sorted array which sum up to the target value. When found, add the combinations into an array, and print it. Where there is greater than one combination, you may use the number 200 as a separator for the combinations in the output array.

Do not use more than one loop. Use pointer notation of arrays to do this question.

In: Computer Science

Using C++ (microsoft visual studios 2013) create a program that uses three parallel numberic arrays of...

Using C++ (microsoft visual studios 2013) create a program that uses three parallel numberic arrays of size 6. The program searches one of the arrays and then displays the corresponding values from the other two arrays. The program should prompt the user to enter ProductID. Valid ProductID's should be the numbers 24, 37, 42, 51, 66 and 79. The program should search the array for the product ID in the ID's array and display the corresponding price and quantity from the prices and quantities array. Populate the prices and quantities arrays with any values you desire. Price should allow for two decimal places. Allow the user to display the price and quantitiy for as many product ID's as desired without having to execute the program again. Of course and bad ProductID's should display an error message, but the user should be able to continue until a sentinel is entered. The program should be structured to work with any numbers should to company change product ID's in the future.

In: Computer Science

Directions: You are to write a C++ program that meets the instruction requirements below. Deliverables: ·Your...

Directions: You are to write a C++ program that meets the instruction requirements below.

Deliverables:

·Your C++ source code file. (The file with the .CPP extension).No other files will be accepted.

  • A screenshot of your program running.

Program Instructions:

Consider the following incomplete C++ program:

#include <iostream>

int main()

{

}

1.    Write a statement that includes the header files fstream, string, and iomanip in this program.

2.    Write statements that declare inFile to be an ifstream variable and outFile to be an ofstream variable.

3.    The program will read data from the file inData.txt and write output to the file outData.txt. Write statements to open both of these files, associate inFile with inData.txt, and associate outFile with outData.txt.

4.    Suppose that the file inData.txt contains the following data:

Giselle Robinson Accounting

5600 5 30

450 9

75 1.5

The first line contains a person’s first name, last name, and the department the person works in. In the second line, the first number represents the monthly gross salary, the bonus (as a percent), and the taxes (as a percent). The third line contains the distance traveled and the traveling time. The fourth line contains the number of coffee cups sold and the cost of each coffee cup. Write statements so that after the program executes, the contents of the file outData.txt are as shown below. If necessary, declare additional variables. Your statements should be general enough so that if the content of the input file changes and the program is run again (without editing and recompiling), it outputs the appropriate results.

Name: Giselle Robinson, Department: Accounting

Monthly Gross Salary: $5600.00, Monthly Bonus: 5.00%, Taxes: 30.00%

Paycheck: $4116.00

Distance Traveled: 450.00 miles, Traveling Time: 9.00 hours

Average Speed: 50.00 miles per hour

Number of Coffee Cups Sold: 75, Cost: $1.50 per cup

Sales Amount = $112.50

5.    Write statements that close the input and output files.

6.    Write a C++ program that tests the statements in parts a through e.

In: Computer Science

Appendix A A retail business wishes to automate some of its sales procedures. The retailer buys...

Appendix A A retail business wishes to automate some of its sales procedures. The retailer buys items in bulk from various manufacturers and re-sells them to the public at a profit. Preliminary interviews reveal that there are number of staff roles in the Sales department. A salesperson can place orders on behalf of customers and check the status of these orders. A technical salesperson has the same duties, but additionally is able to provide customers with detailed technical advice (which we would not expect an ordinary salesperson to be able to do). A sales supervisor is a salesperson, with the additional responsibility of creating new customer accounts and checking their credit-worthiness. A dispatcher is responsible for collecting the goods ordered from the warehouse and packing them for dispatch to the customer. To assist in this operation, the computer system should be able to produce a list of unpacked orders as well as delete the orders from the list that the dispatcher has packed. All staff are able to find general details of the products stocked, including stock levels and locations in the warehouse. A re-ordering clerk is responsible for finding out which products are out of stock in the warehouse, and placing orders for these products from the manufacturers. If these products are required to satisfy an outstanding order, they are considered to be "priority" products, and are ordered first. The system should be able to advise the re-order clerk of which products are "priority” products. A stock clerk is responsible for placing items that arrive from manufacturers in their correct places in the warehouse. To do this the clerk needs to be able to find the correct warehouse location for each product from the computer system. Currently, the same person in the business plays the roles of stock clerks and re-order clerk.

Question 1 Total [20]
1.1 Develop a first-cut design class diagram for the use case for place order object (10)
1.2 Develop a CRC cards for place order object with input classes identified (10)
Question 2 Total [57]
2.1 Create a communication diagram for the use case place order (15)
2.2 Develop a multilayer sequence diagram for the use case place order object which includes
view layer and data layer, incorporate the use of alt and loop frame (22)
2.3 Finally, show an updated DCD (10)
2.4 Design the package diagram

In: Computer Science

Python: Write the function pixelLuminance that takes 3 integers r, g, and b, each between 0...

Python: Write the function pixelLuminance that takes 3 integers r, g, and b, each between 0 and 255 (inclusive), representing the red, green, and blue intensity of a pixel and returns the luminance of this pixel as an integer. The function expects each parameter r, g, and b to be an integer in the interval [0,255]. You should use assertions to enforce this constraint.

In: Computer Science

Write some python programs which demonstrate the following concepts: Input data of all the variable types...

Write some python programs which demonstrate the following concepts:

  • Input data of all the variable types we've covered so far (https://realpython.com/python-variables/)
  • Test input of strings with various quoting styles as previously discussed
  • Output all the variables you read.
  • Format output of all variables to create columnar output.
  • Format output of numbers to 2 decimal places
  • Output using both the string formatting and the 'f' formatted string literals notation.

TURN IN

Submit your source code and execution of your code.

In: Computer Science

6. Convert numbers as requested. SHOW YOUR WORK Convert 2B7 (base 16) to binary. Convert 0B2C...

6. Convert numbers as requested. SHOW YOUR WORK

Convert 2B7 (base 16) to binary.

Convert 0B2C (base 16) to binary.

Convert -47 (base 10) to binary 8-bit signed-magnitude.

Convert -52 (base 10) to binary 8-bit signed-magnitude.

Convert -47 (base 10) to binary 8-bit one's complement.

Convert -52 (base 10) to binary 8-bit one's complement.

Convert -39 (base 10) to 8-bit binary using excess 127 notation.

Convert -61 (base 10) to 8-bit binary using excess 127 notation.

In: Computer Science