Java
Create an abstract Product Class
Add the following private attributes:
name
sku (int)
price (double)
Create getter/setter methods for all attributes
Create a constructor that takes in all attributes and sets them
Remove the default constructor
Override the toString() method and return a String that represents
the building object that is formatted
nicely and contains all information (attributes)
Create a FoodProduct Class that extends Product
Add the following private attributes:
expDate (java.util.Date) for expiration date
refrigerationTemp (int) if 70 or above, none necessary, otherwise it will be a lower number
servingSize (int) in grams
caloriesPerServing (int)
allergens (ArrayList<String>)
Create getter/setter methods for all attributes
Create a constructor that takes in all attributes for product and food product. Call the super constructor and then set the expDate, refrigerationTemp, servingSize, caloriesPerServing and allergens.
Remove the default constructor
Override the toString() method and return a String that represents the food product object that is formatted nicely and contains all information (super toString and the private attributes)
Create a CleaningProduct Class that extends Product
Add the following private attributes:
String chemicalName
String hazards
String precautions
String firstAid
ArrayList<String> uses (e.g. kitchen, bath, laundry, etc)
Create getter/setter methods for all attributes
Create a constructor that takes in all attributes for product and food product. Call the super constructor and then set the chemical name, hazard, precautions, firstAid and uses. TIP: try generating the constructor, it will add the super stuff for you. (Also, see Lynda inheritance videos.)
Remove the default constructor
Override the toString() method and return a String that represents the cleaning product object that is formatted nicely and contains all information (super toString() and the private attributes)
Create the interface Edible which contains the following method signatures:
public Date getExpDate();
public void setRefrigerationTemp(Int refrigerationTemp)
public int getRefrigerationTemp();
public void setExpDate(Date expDate) ;
public int getServingSize() ;
public void setServingSize(int servingSize) ;
public int getCaloriesPerServing() ;
public void setCaloriesPerServing(int caloriesPerServing);
public String getAllergens() ;
public void setAllergens(ArrayList<String> allergens) ;
Create the interface Chemical which contains the following method signatures
public String getChemicalName();
public void setChemicalName(String chemicalName) ;
public String getHazards() ;
public void setHazards(String hazards);
public String getPrecautions() ;
public void setPrecautions(String precautions) ;
public ArrayList<String> getUses() ;
public void setUses(ArrayList<String> uses) ;
public String getFirstAid() ;
public void setFirstAid(String firstAid) ;
Modify the FoodProduct Class to implement Edible, be sure to add the @Override before any methods that were there (get/set methods) that are also in the Edible interface.
Modify the CleaningProduct Class to implement Chemical, be sure to add the @Override before any methods that were there (get/set methods) that are also in the Chemical interface.
Create your main/test class to read products from a file, instantiate them, load them into an ArrayList and then print them nicely to the console at the end of your program. See instructor note about reading the file as the lengths of the lines may be different depending on the list of allergens. It is also comma delimited rather than by spaces. You will have to read an entire line, split its contents and then store the information into variables. The last element(s) are the allergens that you will have to store to an ArrayList.
2 note files:
Frosted Mini Wheats,233345667,4.99,10/2020,70,54,190,Wheat Ingredients Activa YoCrunch Yogurt,33445654,2.50,10/2018,35,113,90,Dairy,Peanuts
Lysol,2344454,4.99,Alkyl (50%C14 40%C12 10%C16) dimethyl benzyl
ammonium saccharinate,Hazard to humans and domestic animals.
Contents under pressure,Causes eye irritation,In case of eye
contact immediately flush eyes thoroughly with water, kitchen,
bath
Windex,4456765,3.99,Sodium citrate (Trisodium citrate),To avoid
electrical shock do not spray at or near electric lines,Undiluted
product is an eye irritant, if contact with eye occurs flush
immediately with plenty of water for at least 15 to 20 minutes,
glass, upholstery, clothing
In: Computer Science
Length of Stay ~ Health insurers and federal government are both putting pressure on hospitals to shorten the average length of stay (LOS) of their patients. The average LOS for women is 4.5774 days according to Statistical Abstract of the United States: 2005.
A first study conducted on a random sample of 18 hospitals in Michigan had a mean LOS for women of 3.8911 days and a standard deviation of 1.2279 days.
A medical researcher wants to determine if the mean LOS for women in Michigan is less than 4.5774 days. The null and alternative hypothesis are given by
H0: μ = 4.5774 u< 2.5774
Note: Numbers are randomized for each instance of this question. Use the numbers given above.
What is the estimated effect size dˆ? Give your answer to 4 decimal places.
In: Statistics and Probability
MAT 204 Discrete Structures – Assignment #10
Number theory is the branch of mathematics concerned with the integers. Traditionally, number theory was a pure branch of mathematics – known for its abstract nature rather than its applications. The great English mathematician, G.H. Hardy (1877 – 1947), used number theory as an example of a beautiful, but impractical, branch of mathematics. However, in the late 1900s, number theory became extremely useful in cryptosystems – systems used for secure communications.
Find the following for each pair of integers:
(a) The prime factorization;
(b) The greatest common divisor;
(c) The least common multiple;
(d) Verify that gcd (m, n) * lcm(m, n) = mn.
(i) 315, 825
(ii) 2091, 4807
In: Advanced Math
A researcher is studying memory for different types of words under low, and high memory load. She uses concrete words (e.g., dog, boat) and abstract words (e.g. love, height) in a factorial design, with five participants in each cell. With part of the information in the summary table, please finish the table and conduct the analysis.
|
Source |
SS |
df |
MS |
F |
|
Between |
2000 |
|||
|
Word Type |
750 |
|||
|
Memory Load |
125 |
|||
|
Load*Type |
||||
|
Within Treatment |
------------ |
|||
|
Total |
3500 |
------------ |
------------ |
a. Test and draw conclusions about the main effect of memory load.
b. Test and draw conclusions about the main effect of word type.
c. Test and draw conclusions about the memory load x word type interaction
In: Statistics and Probability
Test the given claim about the means of two populations. Assume
that two dependent samples have been randomly selected from
normally distributed populations. A test of abstract reasoning is
given to a random sample of students before and after they
completed a formal logic course. The results are given below. At
the 0.05 significance level, test the claim that the mean score is
not affected by the course. Include your null and alternative
hypotheses, the test statistic, P-value or critical value(s),
conclusion about the null hypothesis, and conclusion about the
claim in your answer.
| Before | 74 | 83 | 75 | 88 | 84 | 63 | 93 | 84 | 91 | 77 |
| After | 73 | 77 | 70 | 77 | 74 | 67 | 95 | 83 | 84 | 75 |
In: Statistics and Probability
Create a new product that will serve two business (organizational) markets.
Write a 750-1,000-word paper that describes your product, explains your strategy for entering the markets, and analyzes the potential barriers you may encounter. Explain how you plan to ensure your product will be successful, given your market strategy.
Include an introduction and conclusion that make relevant connections to course objectives.
Prepare this assignment according to the APA guidelines found in the APA Style Guide, located in the Student Success Center. An abstract is not required.
This assignment uses a grading rubric. Instructors will be using the rubric to grade the assignment; therefore, students should review the rubric prior to beginning the assignment to become familiar with the assignment criteria and expectations for successful completion of the assignment.
In: Operations Management
1 .RuntimeException class is a subclass of the Exception class. Fill in the blanks to complete the declaration of the RuntimeException class. _____________ ________________ _________________
|
. |
||
|
. |
||
|
. |
||
3. RuntimeException is a subclass of Exception. The constructor RuntimeException(String message) calls the parent class's constructor with the message argument. Which of the following makes the call correctly?
|
this(message); |
||
|
super(message); |
||
|
super.Exception(message); |
||
|
Exception(message); |
4. RuntimeException has overloaded constructors: the 1-argument constructor RuntimeException(String message) and the 2-argument constructor RuntimeException(String message, Throwable cause).
The 2-argument constructor calls the 1argument constructor with message as the argument. Which of the following makes the call correctly?
|
this(message); |
||
|
RuntimeException(message); |
||
|
this.RuntimeException(message); |
5. RuntimeException is a sublcass of Exception. Both classes have a constructor that takes a String argument. Among the statements below, indicate all that are syntactically correct.
|
Exception e = new Exception("Division by zero problem"); |
||
|
Exception e = new RuntimeException("Division by zero problem"); |
||
|
RuntimeException e = new Exception("Division by zero problem"); |
||
|
RuntimeException e = new RuntimeException("Division by zero problem"); |
6. Payable is an interface with one method payableAmount() that returns double.
(1) The source code of the interface is saved in a file named ____________java
(2) Fill in the blanks to complete code for the interface:
public ____________________ Payable {
public abstract _______________payableAmount();
}
7. The Student class implements the Payable interface without actually implementing the only payableAmount() method declared in the interface. Fill in the blanks to complete the declaration of the Student class:
public _________ class __________ ___________ __________
8. SQLException is unchecked exception, hence handling such exception is optional.
True
False
9. An abstract class can have constructors even though it cannot be instantiated.
True
False
10. In Java, a class can implement more than one interface.
True
False
In: Computer Science
QUESTION 41
Fanciful, arbitrary, suggestive marks; such as Xerox, Google and Apple, have acquired the necessary secondary meaning for obtaining trademark protection
True
False
1 points
QUESTION 42
Generic terms such as aspirin, escalator and cornflakes have acquired a secondary meaning, but they are not entitled to trademark protection
True
False
1 points
QUESTION 43
Trademark common law was created just for commercial products therefore service marks are not protected by common law
True
False
1 points
QUESTION 44
Trade dress refers to the overall image, decor and appearance of a product, but without the same trademark protections as a product.
True
False
1 points
QUESTION 45
A patent is similar to trademarks and is protected upon first use, however it is a good idea to register in order to provide notice to the world that you own the patent
True
False
1 points
QUESTION 46
Virtually anything is patentable except for laws of nature, natural phenomena and abstract ideas
True
False
1 points
QUESTION 47
An abstract idea is protected by copyright law, but only after it has been placed into tangible form; also copyright registration is not required
True
False
1 points
QUESTION 48
The Fair Use Doctrine is an exception to copyright infringement liability
True
False
1 points
QUESTION 49
According to the First Use Doctrine, I can buy a book and reproduce it (within reasonable limits) for the first use, thereafter I would have to pay a royalty
True
False
1 points
QUESTION 50
A trade secret is no longer a trade secret if it is disclosed, therefore if a key employee with knowledge of a trade secret resigns or is fired, you probably have lost your trade secret
True
False
In: Economics
Swifty Supply Company, a newly formed corporation, incurred the following expenditures related to Land, to Buildings, and to Machinery and Equipment. Abstract company’s fee for title search $936 Architect’s fees 5,706 Cash paid for land and dilapidated building thereon 156,600 Removal of old building $36,000 Less: Salvage 9,900 26,100 Interest on short-term loans during construction 13,320 Excavation before construction for basement 34,200 Machinery purchased (subject to 2% cash discount, which was not taken) 99,000 Freight on machinery purchased 2,412 Storage charges on machinery, necessitated by noncompletion of building when machinery was delivered 3,924 New building constructed (building construction took 6 months from date of purchase of land and old building) 873,000 Assessment by city for drainage project 2,880 Hauling charges for delivery of machinery from storage to new building 1,116 Installation of machinery 3,600 Trees, shrubs, and other landscaping after completion of building (permanent in nature) 9,720 Determine the amounts that should be debited to Land, to Buildings, and to Machinery and Equipment. Assume the benefits of capitalizing interest during construction exceed the cost of implementation. Company uses net method to record discount. (Please leave spaces blank if there is no answer. Do not enter zeros in those spaces.) Land Buildings Machinery and Equipment Other Abstract company’s fee for title search $ $ $ $ Architect’s fees Cash paid for land and old building Removal of old building Interest on short-term loans during construction Excavation before construction for basement Machinery purchased Freight on machinery purchased Storage charges on machinery New building constructed Assessment by city for drainage project Hauling charges Installation of machinery Trees, shrubs, and other landscaping $ $ $ $
In: Accounting
Question: An ATM can only dispense bills of the following denominations: $500, $100, $50, $10, $5, and $1
When a user withdraws an amount from the ATM, the machine tries to dispense the amount using the least number of bills possible.
For instance, if the user requests $1234, the ATM dispenses 2 bills of $500 + 2 bills of $100 + 3 bills of $10 + 4 bills of $1. On the other hand, if the user requests $1235, the machine dispenses 2 bills of $500 + 2 bills of $100 + 3 bills of $10 + 1 bill of $5
Use the skeleton code provided to create an ATM dispenser that takes the amount and prints the least number of bills that makes up the amount in the following format:
__ bills of $500 + __ bills of $100 + __ bills of $50 + __ bills of $10 + __ bills of $5 + __ bills of $1
Apply chain of responsibility pattern such that each denomination is handled by a separate handler.
Below is the code:
abstract class Handler
{
Handler successor;
abstract public String dispense(int amount);
}
class Handler500 extends Handler
{
}
class Handler100 extends Handler
{
}
class Handler50 extends Handler
{
}
class Handler10 extends Handler
{
}
class Handler5 extends Handler
{
}
class Handler1 extends Handler
{
}
class ATM
{
Handler handler;
public ATM(Handler handler)
{
this.handler = handler;
}
public string dispense(int amount)
{
return handler.dispense();
}
}
public class ATMTester
{
public static void main(String[] args)
{
ATM atm;
/// TODO - create an ATM object with the appropriate handlers and store it in the variable "atm"
System.out.println(atm.dispense(1234)); // should display: 2 bills of $500 + 2 bills of $100 + 3 bills of $10 + 4 bills of $1
System.out.println(atm.dispense(1235)); // should display: 2 bills of $500 + 2 bills of $100 + 3 bills of $10 + 1 bills of $5
}
}
In: Computer Science