Please write the class and class with main method clearly!! This is to be written in JAVA.
Step 1 Develop the following class:
Class
Name: Bag
Access Modifier: public
Instance variables
1-Name: name
Access modifier: private
Data Type: String
2-Name: currentWeight
Access modifier: private
Data Type: double
3-Name: maximumWeight
Access modifier: private
Data Type: double
Constructors
Name: Bag
Access modifier: public
Parameters: none (default constructor)
Task: sets the value of the instance variable name to the empty string sets the value of the
instance variable currentWeight to 0.0 sets the value of the instance variable maximumWeight to
5.0
Methods
Name: setName
Access modifier: public
Parameters: newName
Return Type: void
Task: sets the value of the instance variable name to newName
Name: getName
Access modifier: public
Parameters: none
Return Type: String
Task: returns the value of the instance variable name
Name: addItem
Access modifier: public
Parameters: newWeight Return
Type: void
Task: sets the value of the instance variable currentWeight equal to the value of currentWeight
plus the value of newWeight if the value of newWeight is greater than 0 and if the value of
currentWeight plus the value of newWeight is less than or equal to the value of the instance
variable maximumWeight
Name: getCurrentWeight
Access modifier: public
Parameters: none
Return Type: double
Task: returns the value of the instance variable currentWeight
Name: setMaximumWeight
Access modifier: public
Parameters: newMaximumWeight
Return Type: void
Task: sets the value of the instance variable maximumWeight to value of the
newMaximumWeight if newMaximumWeight is greater than 0 and greater than or equal to the
value of the instance variable currentWeight
Name: getMaximumWeight
Access modifier: public
Parameters: none
Return Type: double
Task: returns the value of the instance variable maximumWeight
Step 2
Develop a class with only a main method in it:
import java.util.Scanner;
public class BagDemo {
public static void main(String[] args) {
//Create a Scanner object called keyboard that takes input from //System.in //Create an object of
the Bag class refer to this object as myBag //declare a variable called option of type int //Open a
do/while loop //Prompt the user to pick one of the following options: //Press 1 to change the
name of the bag //Press 2 to add an item to the bag //Press 3 to change the maximum weight of
the bag //Press 4 to view all information about the bag //Press 5 to end the program //Save the
user’s input into the option variable //if the user picks option 1, prompt the user for the name of
the bag //then save the name of the bag in a variable called newName //change the name of the
bag to newName //else if the user picks option 2, prompt the user for the weight //of the item and
then save the weight of the item in a variable //called newWeight //add the new item to the bag
//else if the user picks option 3, prompt the user for the new maximum //wei.
Write a program that mimics the operations of several vending machin.pdfeyebolloptics
Write a program that mimics the operations of several vending machines. More specifically, the
program simulates what happens when the user chooses one of the vending machines, inputs
money and picks an item from the vending machine. Assume there are two vending machines:
one for drinks and one for snacks. Each vending machine contains several items. The name,
price, and quantity of each item is given in two text files; one named “drinks.txt” for the drinks
vending machine and the other named “snacks.txt” for the snacks vending machine.
The format of the input values is comma-separated. The items listed should be organized in the
file with the following order: name, price, quantity. Here are some example items:
The actual reading and parsing of the input file is already handled in the class supplied to you
(see code on BlackBoard). You are given the variables as individual values. You will need to
create the .txt files for creating and testing your vending machines.
You will need to create/complete three classes for this homework assignment: Item,
VendingMachine, and VendingMachineDriver.
Problem Description
Milk,2.00,1
Within your VendingMachine class, include these methods:
VendingMachineThisconstructormethodwilltakeinthenameoftheinputfileand create a vending
machine object. A vending machine object will contain an array of Item objects called stock and
an amount of revenue earned. This constructor method has been completed for you and should
work appropriately once you have completed the rest of this class and the other class definitions.
vendThismethodwillsimulatethevendingtransactionafteravalidamountofmoney and an item
selection are entered. This method will decide if the transaction is successful (enough money or
item) and update the vending machine appropriately.
outputMessage This method will print an appropriate message depending on the success of the
transaction. If the user does not have enough money to buy the chosen item, the vending machine
should prompt the user to enter more money or exit the machine. If the vending machine is out of
the chosen item, the program will print an apology message and prompt the user to choose
another item or exit the machine. If there is enough money for the item selected, then the
vending machine will give the user the item and return the change.
printMenuThismethodprintsthemenuofitemsforthechosenvendingmachine. The Item class needs
to include the following data variables:
• description as a String
• price as a double
• quantity as an int
Within your VendingMachineDriver class, include a main method as the starting point for your
solution that creates the vending machine objects appropriately and then use a loop that
continues interacting with the vending machines until the user enters “X” to exit. See the sample
session for details.
As you implement your solution, you might find that some methods contain some repeated
coding logic. To avoid unnecessary redundancies in your code, have these method.
This is a java lab assignment. I have added the first part java re.pdffeetshoemart
This is a java lab assignment. I have added the first part \"java retail class\" at the bottom. I am
unsure how to read the txt file into an array from the retail class. The stock txt file has been
added also.
A beginning framework and inventory list has been provided to you to use your Retail Item Class
as an array. Develop a program to accomplish the following menu items that can be selected by
the end user. Discussion of what each menu item should do is provided below the menu item.
Modify your object class file as desired. Please append initials to files created. Use Select-Case
for menu choices and methods to perform those choices. Please make a selection: 1. Open
Inventory File (This should ask the user for the file name, open the file and load the data into the
object array). 2. Display All (This should show a table of all items and data) 3. Display Reorder
Only (This should show only the stock number, Description and current quantity for items
requiring reorder) 4. Find Stock number (Allows the user to enter part of the description and
displays all matching stock numbers and descriptions matching that - case insensitive, such as
“cubs” or “cubs”) 5. Display Stock number (Allows user to enter stock number and displays
record of item) 6. Add Quantity (Asks for stock number and quantity for units, adds it to current,
displays record results) 7. Subtract Quantity (Asks for stock number and quantity, subtracts,
displays results including if reorder is needed.) 8. Change Price (Asks for stick number, changes
price to provided value, display results). 9. New Item (Allows adding a new item, updates count.
Display record results). 10. Save Inventory File (asks user for file name, save all inventory to
that file in a format that can be read back.)
public class RetailItem{
private String description;
private int unitsOnHand;
private double price;
private int restock;
public void setDescription(String userDescription){
description=userDescription;
}
public void setUnitsOnHand(int userUnitsOnHand){
unitsOnHand=userUnitsOnHand;
}
public void setPrice(double userPrice){
price=userPrice;
}
public String getDescription(){
return description;
}
public int getUnitsOnHand(){
return unitsOnHand;
}
public double getPrice(){
return price;
}
public double getTotal(){
int total = unitsOnHand=(int) price;
return total;
}
public boolean getRestock(){
return false;
}
public RetailItem(String descriptionGiven, int unitsOnHandGiven, double priceGiven, int
restockGiven){
description=descriptionGiven;
unitsOnHand=unitsOnHandGiven;
price=priceGiven;
restock=restockGiven;
}
}
Solution
public class RetailItem{
private int stocknumber;
private String description;
private int unitsOnHand;
private double price;
private int restock;
public void setDescription(String userDescription){
description=userDescription;
}
public int getStocknumber() {
return stocknumber;
}
public void setStocknumber(int stocknumber) {
this.stocknumber = stocknumber;
}
public void setUnitsOnHand(in.
Vehicle.javapublic class Vehicle { Declaring instance var.pdfanujsharmaanuj14
Vehicle.java
public class Vehicle
{
//Declaring instance variables
private int max_no_passengers;
private int top_speed;
private double miles_travelled;
//Parameterized constructor
public Vehicle(int max_no_passengers, int top_speed, double miles_travelled) {
super();
this.max_no_passengers = max_no_passengers;
this.top_speed = top_speed;
this.miles_travelled = miles_travelled;
}
//Getters and setters
public int getMax_no_passengers() {
return max_no_passengers;
}
public void setMax_no_passengers(int max_no_passengers) {
this.max_no_passengers = max_no_passengers;
}
public int getTop_speed() {
return top_speed;
}
public void setTop_speed(int top_speed) {
this.top_speed = top_speed;
}
public double getMiles_travelled() {
return miles_travelled;
}
public void setMiles_travelled(double miles_travelled) {
this.miles_travelled = miles_travelled;
}
/* This getInfor() method returns the information about this vehicle class object
* Params: void
* Return:String
*/
public String getInfo()
{
String str=\"\ Maximum No of Passengers :\"+getMax_no_passengers()+
\"\ Top Speed :\"+getTop_speed()+
\"\ Total Miles Travelled :\"+getMiles_travelled();
return str;
}
}
_____________________________________________
FoodTruck.java
import java.util.ArrayList;
public class FoodTruck extends Vehicle{
//Declaring instance variables
private String name;
private ArrayList menu;
//Parameterized constructor
public FoodTruck(int max_no_passengers, int top_speed,
double miles_travelled, String name, ArrayList menu) {
super(max_no_passengers, top_speed, miles_travelled);
this.name = name;
this.menu = menu;
}
//Getters and setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ArrayList getMenu() {
return menu;
}
public void setMenu(ArrayList menu) {
this.menu = menu;
}
/* This getInfor() method returns the information about this Food truck class Object
* And also the information about the Vehicle class Object.
* Params: void
* Return:String
*/
@Override
public String getInfo() {
String str=\"Food Truck Name : \"+name+
\"\ Menu of items : \"+menu+super.getInfo();
return str;
}
}
________________________________________________
Test.java
import java.util.ArrayList;
public class Test {
public static void main(String[] args) {
//Creating an ArrayList Object which holds List of Menu Items
ArrayList menu1=new ArrayList();
//Adding menu items to the ArrayList
menu1.add(\"Burger\");
menu1.add(\"Pizza\");
menu1.add(\"Chips\");
//Creating FoodTruck Object by passing parameters.
FoodTruck truck1=new FoodTruck(15,100,10000,\"Mobile Food Court\",menu1);
//Displaying the Truck1 Information.
System.out.println(\"__________Truck 1 Details__________\");
System.out.println(truck1.getInfo());
//Creating an ArrayList Object which holds List of Menu Items
ArrayList menu2=new ArrayList();
//Adding menu items to the ArrayList
menu2.add(\"Tea\");
menu2.add(\"Coffe\");
menu2.add(\"Cool Drinks\");
//Creating FoodTruck Object by passing parameters.
Write a program that mimics the operations of several vending machin.pdfeyebolloptics
Write a program that mimics the operations of several vending machines. More specifically, the
program simulates what happens when the user chooses one of the vending machines, inputs
money and picks an item from the vending machine. Assume there are two vending machines:
one for drinks and one for snacks. Each vending machine contains several items. The name,
price, and quantity of each item is given in two text files; one named “drinks.txt” for the drinks
vending machine and the other named “snacks.txt” for the snacks vending machine.
The format of the input values is comma-separated. The items listed should be organized in the
file with the following order: name, price, quantity. Here are some example items:
The actual reading and parsing of the input file is already handled in the class supplied to you
(see code on BlackBoard). You are given the variables as individual values. You will need to
create the .txt files for creating and testing your vending machines.
You will need to create/complete three classes for this homework assignment: Item,
VendingMachine, and VendingMachineDriver.
Problem Description
Milk,2.00,1
Within your VendingMachine class, include these methods:
VendingMachineThisconstructormethodwilltakeinthenameoftheinputfileand create a vending
machine object. A vending machine object will contain an array of Item objects called stock and
an amount of revenue earned. This constructor method has been completed for you and should
work appropriately once you have completed the rest of this class and the other class definitions.
vendThismethodwillsimulatethevendingtransactionafteravalidamountofmoney and an item
selection are entered. This method will decide if the transaction is successful (enough money or
item) and update the vending machine appropriately.
outputMessage This method will print an appropriate message depending on the success of the
transaction. If the user does not have enough money to buy the chosen item, the vending machine
should prompt the user to enter more money or exit the machine. If the vending machine is out of
the chosen item, the program will print an apology message and prompt the user to choose
another item or exit the machine. If there is enough money for the item selected, then the
vending machine will give the user the item and return the change.
printMenuThismethodprintsthemenuofitemsforthechosenvendingmachine. The Item class needs
to include the following data variables:
• description as a String
• price as a double
• quantity as an int
Within your VendingMachineDriver class, include a main method as the starting point for your
solution that creates the vending machine objects appropriately and then use a loop that
continues interacting with the vending machines until the user enters “X” to exit. See the sample
session for details.
As you implement your solution, you might find that some methods contain some repeated
coding logic. To avoid unnecessary redundancies in your code, have these method.
This is a java lab assignment. I have added the first part java re.pdffeetshoemart
This is a java lab assignment. I have added the first part \"java retail class\" at the bottom. I am
unsure how to read the txt file into an array from the retail class. The stock txt file has been
added also.
A beginning framework and inventory list has been provided to you to use your Retail Item Class
as an array. Develop a program to accomplish the following menu items that can be selected by
the end user. Discussion of what each menu item should do is provided below the menu item.
Modify your object class file as desired. Please append initials to files created. Use Select-Case
for menu choices and methods to perform those choices. Please make a selection: 1. Open
Inventory File (This should ask the user for the file name, open the file and load the data into the
object array). 2. Display All (This should show a table of all items and data) 3. Display Reorder
Only (This should show only the stock number, Description and current quantity for items
requiring reorder) 4. Find Stock number (Allows the user to enter part of the description and
displays all matching stock numbers and descriptions matching that - case insensitive, such as
“cubs” or “cubs”) 5. Display Stock number (Allows user to enter stock number and displays
record of item) 6. Add Quantity (Asks for stock number and quantity for units, adds it to current,
displays record results) 7. Subtract Quantity (Asks for stock number and quantity, subtracts,
displays results including if reorder is needed.) 8. Change Price (Asks for stick number, changes
price to provided value, display results). 9. New Item (Allows adding a new item, updates count.
Display record results). 10. Save Inventory File (asks user for file name, save all inventory to
that file in a format that can be read back.)
public class RetailItem{
private String description;
private int unitsOnHand;
private double price;
private int restock;
public void setDescription(String userDescription){
description=userDescription;
}
public void setUnitsOnHand(int userUnitsOnHand){
unitsOnHand=userUnitsOnHand;
}
public void setPrice(double userPrice){
price=userPrice;
}
public String getDescription(){
return description;
}
public int getUnitsOnHand(){
return unitsOnHand;
}
public double getPrice(){
return price;
}
public double getTotal(){
int total = unitsOnHand=(int) price;
return total;
}
public boolean getRestock(){
return false;
}
public RetailItem(String descriptionGiven, int unitsOnHandGiven, double priceGiven, int
restockGiven){
description=descriptionGiven;
unitsOnHand=unitsOnHandGiven;
price=priceGiven;
restock=restockGiven;
}
}
Solution
public class RetailItem{
private int stocknumber;
private String description;
private int unitsOnHand;
private double price;
private int restock;
public void setDescription(String userDescription){
description=userDescription;
}
public int getStocknumber() {
return stocknumber;
}
public void setStocknumber(int stocknumber) {
this.stocknumber = stocknumber;
}
public void setUnitsOnHand(in.
Vehicle.javapublic class Vehicle { Declaring instance var.pdfanujsharmaanuj14
Vehicle.java
public class Vehicle
{
//Declaring instance variables
private int max_no_passengers;
private int top_speed;
private double miles_travelled;
//Parameterized constructor
public Vehicle(int max_no_passengers, int top_speed, double miles_travelled) {
super();
this.max_no_passengers = max_no_passengers;
this.top_speed = top_speed;
this.miles_travelled = miles_travelled;
}
//Getters and setters
public int getMax_no_passengers() {
return max_no_passengers;
}
public void setMax_no_passengers(int max_no_passengers) {
this.max_no_passengers = max_no_passengers;
}
public int getTop_speed() {
return top_speed;
}
public void setTop_speed(int top_speed) {
this.top_speed = top_speed;
}
public double getMiles_travelled() {
return miles_travelled;
}
public void setMiles_travelled(double miles_travelled) {
this.miles_travelled = miles_travelled;
}
/* This getInfor() method returns the information about this vehicle class object
* Params: void
* Return:String
*/
public String getInfo()
{
String str=\"\ Maximum No of Passengers :\"+getMax_no_passengers()+
\"\ Top Speed :\"+getTop_speed()+
\"\ Total Miles Travelled :\"+getMiles_travelled();
return str;
}
}
_____________________________________________
FoodTruck.java
import java.util.ArrayList;
public class FoodTruck extends Vehicle{
//Declaring instance variables
private String name;
private ArrayList menu;
//Parameterized constructor
public FoodTruck(int max_no_passengers, int top_speed,
double miles_travelled, String name, ArrayList menu) {
super(max_no_passengers, top_speed, miles_travelled);
this.name = name;
this.menu = menu;
}
//Getters and setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ArrayList getMenu() {
return menu;
}
public void setMenu(ArrayList menu) {
this.menu = menu;
}
/* This getInfor() method returns the information about this Food truck class Object
* And also the information about the Vehicle class Object.
* Params: void
* Return:String
*/
@Override
public String getInfo() {
String str=\"Food Truck Name : \"+name+
\"\ Menu of items : \"+menu+super.getInfo();
return str;
}
}
________________________________________________
Test.java
import java.util.ArrayList;
public class Test {
public static void main(String[] args) {
//Creating an ArrayList Object which holds List of Menu Items
ArrayList menu1=new ArrayList();
//Adding menu items to the ArrayList
menu1.add(\"Burger\");
menu1.add(\"Pizza\");
menu1.add(\"Chips\");
//Creating FoodTruck Object by passing parameters.
FoodTruck truck1=new FoodTruck(15,100,10000,\"Mobile Food Court\",menu1);
//Displaying the Truck1 Information.
System.out.println(\"__________Truck 1 Details__________\");
System.out.println(truck1.getInfo());
//Creating an ArrayList Object which holds List of Menu Items
ArrayList menu2=new ArrayList();
//Adding menu items to the ArrayList
menu2.add(\"Tea\");
menu2.add(\"Coffe\");
menu2.add(\"Cool Drinks\");
//Creating FoodTruck Object by passing parameters.
Ive already completed the Java assignment below, but it doesnt wor.pdffantasiatheoutofthef
I've already completed the Java assignment below, but it doesn't work. I will include my code
and the tests. Please correct my code and tests to that they match what has been asked and
reached 95% test coverage as asked for in the assignment.
Assignment: Disease File Repository
This assignment is a continuation of the last assignment. Please use the Eclipse project that you
created in the first assignment for this work.
Source Code
Class: Exposure
Copy the Exposure class from the previous assignment into the new. Make the necessary
changes so that this class can be serialized.
Class: Patient
Copy Patient class from the previous assignment into the new. Make the necessary changes so
that this class can be serialized and that it uses the Exposure class class.
Class: Disease
Copy the Disease, the InfectiousDisease, the NonInfectiousDisease classes from the previous
assignment into the new. Make the necessary changes so that they can be serialized.
Class: DiseaseAndPatient
Create a class called DiseaseAndPatient and define the follwing properties:
private Disease[] diseases;
private Patients[] patients;
Create getter and setter methods for the two arrays and document the new methods using the
Javadoc standard.
Class: DiseaseFileRepository
Create a class called DiseaseFileRepository and define the following methods:
DiseaseAndPatient init(String folderPath)
This method accepts a file path to the folder where the data was serialiaed and set the folder path
to a propert on this class. Deserialize the disease data from the file named diseases.dat.
Deserialize the patient data from the file named patients.fat. Set both the deserialized disease and
patient arrays to an instance of the DiseaseAndPatient class and return that instance. Throw an
IllegalArgumentException with an appropriate message if the supplied folder path is null.
void save(Disease[] diseases, Patient[] patients)
This method serializes and saves the supplied disease and patient array data to two separate files
on the file system using the folder path from the init method. Serialize the disease array data to a
file named disease.dat and the patient array data to the file name patients.dat.
Documentation
You are required to document the class, constructor, and methods using Javadoc standard.
Class: DiseaseFileRepositoryTest
Create a class called DiseaseFileRepositoryTest to test your DiseaseFileRespository class. You
must achieve at least 95% test coverage on the DiseaseFileRepository class.
Class: DiseaseControlManager and DiseaseControlManagerImpl
Copy the DiseaseControlManager interface and the DiseaseControlMangerImpl class from the
previous assignment and into the new. The DiseaseControlManager implementation will use the
DiseaseFileRepository class that you created in this assignment to initialize and save the disease
and patient data.
Constructor
Add a DiseaseFileRepository property to the DiseaseControlManager implementation and
initialize the property in the constructor of the D.
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdfalbarefqc
Adapt your code from Assignment 2 to use both a Java API ArrayList and a Java API LinkedList
and your new I_a (fish) objects from Assignment 3. The new program should have a main user
menu like in A2 with an added choice to print the list backwards. There should be a new
makeFish static method and a printing method similar to that in A2 renamed to printForwards
and one new method printBackwards.
Making Fish When making an I_a object in the makeFish method, instead of asking the user to
enter all the information as you did for Pokemon in A2, make a sub-menu for them to pick from
the 14 kinds of I_a implemented in A3
The only thing the user must choose is the I_a type and if they want to enter the length (or get a
random length) You should ask, Do you want to enter a length for your I'a, Y/N HINT: use
equalsIgnoreCase to simplify user input If they choose to enter the length then you will need to
ask for the length and convert the input to a double for the constructor.
You will need to try/catch for non-number and FishSizeException. This will need to loop until
you get a valid length. Finally use a switch to call the constructor for the chosen I_a. For
example: case 1: I_a ia = new Pua_ama(); or case 7: I_a ia = new PalaMoi(14.25); or case 9:I_a
ia = new Ohua(3.3));
Lists of Fish The program should have both a Java API ArrayList and LinkedList. You must
correctly declare both generic types to hold I_a objects. They should be local to the main method
(like the array in A2). Use the List interface to declare both list variables, then initialize as the
two different kinds of lists: List List1 = new ArrayList<>(); List List2 = new LinkedList<>();
Add each I_a the user makes to both lists. To add the first six I_a you can use the List Interface
add method: List.add(E element) This will add to the end (higher index) of both kinds of lists.
The allowed number of stored I_a should be limited to 6 like in the array in A2.
Don't let either List keep growing even though they can! The lists should work the same as in
A2, the 7th I_a should "wrap around" and overwrite the first I_a made (in index 0), and so on. To
overwrite existing elements using the List.set(int index, E element) method. Printing Lists The
printArray method from A2 should be renamed to printForwards, it should still be void, and
should take one parameter of type List instead of an array. The new printBackwards method will
be nearly identical, but will print a List in reverse index order: 5 4 3 2 1 0 Both methods must use
ListIterators to print the List contents. The printForwards method should get the ArrayList sent
to it from the menu choice to print the list and should print out just like the old array did,
forwards. The printBackwards method should have the LinkedList sent to it from the menu
choice to print the list backwards and should print out in REVERSE order.
HERE IS I.a java code:
import java.util.Random;
public abstract class I_a {
protected final String name;
protected final S.
Java Polymorphism: Types And Examples (Geekster)Geekster
Polymorphism is one of the 4 pillars of Object-Oriented Programming. It is a
combination of two Greek words: poly and morphs. “Poly” means “many,” and
“morphs” means “forms.” So in Java, polymorphism means many forms.
Polymorphism is defined as the ability of a message to be displayed in more than
one form.
These are the outputs which should match they are 4 of them -outp.pdfudit652068
These are the outputs which should match they are 4 of them :-
output 1 -
output 2 -
output 3 -
output 4 -
Here is the Assingment5.java file can make changes to it :-
You are required, but not limited, to turn in the following source files:
Assignment5.java (Download this file and use it as your driver program for this assignment. You
need to add more codes to complete it.)
Soup.java
SoupInBox.java
SoupInCylinder.java
SoupParser.java
Requirements to get full credits in Documentation
The assignment number, your name, StudentID, Lecture number/time, and a class description
need to be included at the top of each class/file.
A description of each method is also needed.
Some additional comments inside of methods (especially for a \"main\" method) to explain code
that are hard to follow should be written.
You can look at Java programs in the text book to see how comments are added to programs.
Skills to be Applied
In addition to what has been covered in previous assignments, the use of the following items,
discussed in class, will probably be needed:
Inheritance
The protected modifier
The super Reference
Abstract class
NumberFormat/DecimalFormat
Wrapper classes
ArrayList
Program Description
Class Diagram:
In Assignment #5, you will need to make use of inheritance by creating a class hierarchy for
vehicles.
Soup is an abstract class, which represents the basic attributes of any soup in a container to be
sold. It is used as the root of the soup hierarchy. It has the following attributes (should be
protected):
Attribute name
Attribute type
Description
volume
int
The volume of the soup
unitPrice
double
The price per unit of the soup
totalPrice
double
The total price of the soup
soupId
String
The Id of the soup
The following constructor method should be provided to initialize the instance variables.
publicSoup(String id, double someUnitPrice)
The instance variable volume is initialized to 0, totalPrice is initialized to 0.0, unitPrice is
initialized to the value of the second parameter, and soupId is initialized to the string value of the
first parameter.
The following accessor method should be provided for soupId :
publicString getSoupId()
The Class Soup also has an abstract method (which should be implemented by its child classes,
SoupInCylinder and SoupInBox) to compute the volume of the soup:
publicabstract void computeTotalPrice();
The following public method should be provided:
publicString toString()
toString method returns a string of the following format:
\ The SoupId:\\t\\ttomatosoup591\
The Volume:\\t\\t150\
The Unit Price:\\t\\t0.0015\
The Total Price:\\t$330.00\ \
You should make use of the NumberFormat class and DecimalFormat (in java.text package) to
format the total price in the dollar format (NumberFormat) and the unit price using 4 digits after
their decimal point (DecimalFormat using \"0.0000\").
SoupInCylinder class
SoupInCylinder is a subclass of Soup class. It represents a soup in a can (cylinder). It has the
following attribute in.
Code to copy:
/******************** Person.java **********************/
// Create a class Person
publicclass Person
{
// Declare variables
private String name;
private MyDate birthdate; // This is a date based on a Person\'s birthday
// Create accessor method for the name
public String getName()
{
return name;
}
// Create mutator method for name
publicvoid setName(String name)
{
this.name = name;
}
// Create accessor method for the name
public MyDate getBirthdate()
{
return birthdate;
}
// Create mutator method for name
publicvoid setBirthdate(MyDate birthdate)
{
this.birthdate = birthdate;
}
// Create a parameter constructor
public Person(String name, int pp, int kk, int vv)
{
this(name, new MyDate(pp, kk, vv));
}
// Create a parameter constructor
public Person(String name, MyDate birthday)
{
this(name);
this.birthdate = birthday;
}
// Create a parameter constructor
public Person(String name) {
this.name = name;
}
// Create to string method to display person data
@Override
public String toString() {
return \"Person [name=\" + name + \", birthdate=\" + birthdate + \"]\";
}
}
/******************** MyDate.java **********************/
// Create a class named MyDate
class MyDate
{
// Declare variables
privateint day;
privateint month;
privateint year;
// Create a default constructor
public MyDate(int month, int day, int year)
{
this.day = day;
this.month = month;
this.year = year;
}
// Create a compareTo method to compare the date objects
int compareTo(MyDate obj)
{
if(obj.day==this.day && obj.month==this.month && obj.year==this.year)
{
return 0;
}
elseif(obj.year>this.year)
{
return 1;
}
elseif(obj.year > this.year && obj.month > this.month)
{
return 1;
}
elseif(obj.year > this.year && obj.month > this.month && obj.day==this.day)
{
return 1;
}
else
return -1;
}
// Create a toString() method to display the date
@Override
public String toString()
{
return \"MyDate [day=\" + day + \", month=\" + month + \", year=\" + year + \"]\";
}
}
/******************** PersonSort.java **********************/
// import statements
import java.util.*;
import java.io.*;
// Create a class PersonSort
publicclass PersonSort implements Comparator
{
// Create compare method to compare two objects
@Override
publicint compare(Person o1, Person o2)
{
return 0;
}
// Create a main method to test the program
publicstaticvoid main(String [] args)
{
// Declare variables
String line;
String fileName=\"dataFile.txt\";
String data=\"\";
// Create a array list for the person class
ArrayList person= new ArrayList();
// Create a try block to handle the run time exceptions
try
{
// Create an object for the FileReader class
FileReader fileReader = new FileReader(fileName);
BufferedReader bufferedReader = new BufferedReader(fileReader);
// Create a for loop to read the data in the file dataFile.txt
while ((line = bufferedReader.readLine()) != null)
{
data+=line;
}
}
// Create a catch block to catch run time exceptions.
catch (FileNotFoundException ex)
{
System.out.println(\"Unable to op.
Here is the assignment5.java file -You are required, but not limi.pdfmallik3000
Here is the assignment5.java file :-
You are required, but not limited, to turn in the following source files:
Assignment5.java (Download this file and use it as your driver program for this assignment. You
need to add more codes to complete it.)
Soup.java
SoupInBox.java
SoupInCylinder.java
SoupParser.java
Requirements to get full credits in Documentation
The assignment number, your name, StudentID, Lecture number/time, and a class description
need to be included at the top of each class/file.
A description of each method is also needed.
Some additional comments inside of methods (especially for a \"main\" method) to explain code
that are hard to follow should be written.
You can look at Java programs in the text book to see how comments are added to programs.
Skills to be Applied
In addition to what has been covered in previous assignments, the use of the following items,
discussed in class, will probably be needed:
Inheritance
The protected modifier
The super Reference
Abstract class
NumberFormat/DecimalFormat
Wrapper classes
ArrayList
Program Description
Class Diagram:
In Assignment #5, you will need to make use of inheritance by creating a class hierarchy for
vehicles.
Soup is an abstract class, which represents the basic attributes of any soup in a container to be
sold. It is used as the root of the soup hierarchy. It has the following attributes (should be
protected):
Attribute name
Attribute type
Description
volume
int
The volume of the soup
unitPrice
double
The price per unit of the soup
totalPrice
double
The total price of the soup
soupId
String
The Id of the soup
The following constructor method should be provided to initialize the instance variables.
publicSoup(String id, double someUnitPrice)
The instance variable volume is initialized to 0, totalPrice is initialized to 0.0, unitPrice is
initialized to the value of the second parameter, and soupId is initialized to the string value of the
first parameter.
The following accessor method should be provided for soupId :
publicString getSoupId()
The Class Soup also has an abstract method (which should be implemented by its child classes,
SoupInCylinder and SoupInBox) to compute the volume of the soup:
publicabstract void computeTotalPrice();
The following public method should be provided:
publicString toString()
toString method returns a string of the following format:
\ The SoupId:\\t\\ttomatosoup591\
The Volume:\\t\\t150\
The Unit Price:\\t\\t0.0015\
The Total Price:\\t$330.00\ \
You should make use of the NumberFormat class and DecimalFormat (in java.text package) to
format the total price in the dollar format (NumberFormat) and the unit price using 4 digits after
their decimal point (DecimalFormat using \"0.0000\").
SoupInCylinder class
SoupInCylinder is a subclass of Soup class. It represents a soup in a can (cylinder). It has the
following attribute in addition to the inherited ones:
Attribute name
Attribute type
Description
radius
int
The radius of the cylinder of the soup.
heig.
Hello need help on this lab- what you need to do is add a code to Arra.pdfIan0J2Bondo
Hello need help on this lab, what you need to do is add a code to ArrayBag methods
equals,duplicateAll,removeDuplicates and remove according to the screenshots and then run it
with the JUnit tests present in ArrayBagTest. I will leave both programs here.
/**
A class of bags whose entries are stored in a fixed-size array.
@author Frank M. Carrano, Timothy M. Henry
* The toString method is overwritten to give a nice display of the items in
* the bag in this format Bag{Size:# [1] [2] [3] [4] }
*
* Extra methods added for lab exercise by Charles Hoot
* //- * @version 5.1
*/
public final class ArrayBag<T> implements BagInterface<T> {
private final T[] bag;
private int numberOfEntries;
private boolean integrityOK = false;
private static final int DEFAULT_CAPACITY = 25;
private static final int MAX_CAPACITY = 10000;
/** Creates an empty bag whose initial capacity is 25. */
public ArrayBag() {
this(DEFAULT_CAPACITY);
} // end default constructor
/** Creates an empty bag having a given capacity.
@param desiredCapacity The integer capacity desired. */
public ArrayBag(int desiredCapacity) {
if (desiredCapacity <= MAX_CAPACITY) {
// The cast is safe because the new array contains null entries
@SuppressWarnings("unchecked")
T[] tempBag = (T[]) new Object[desiredCapacity]; // Unchecked cast
bag = tempBag;
numberOfEntries = 0;
integrityOK = true;
// Test that contents are nulls - OK
// for (int index = 0; index < desiredCapacity; index++)
// System.out.print(bag[index] + " ");
// System.out.println();
} else
throw new IllegalStateException("Attempt to create a bag " +
"whose capacity exceeds " +
"allowed maximum.");
} // end constructor
/** Adds a new entry to this bag.
@param newEntry The object to be added as a new entry.
@return True if the addition is successful, or false if not. */
public boolean add(T newEntry) {
checkIntegrity();
boolean result = true;
if (isArrayFull()) {
result = false;
} else { // Assertion: result is true here
bag[numberOfEntries] = newEntry;
numberOfEntries++;
}
return result;
}
// public <T> T[] toArray() //OK
public T[] toArray() // OK
{
checkIntegrity();
@SuppressWarnings("unchecked")
T[] result = (T[]) new Object[numberOfEntries]; // Unchecked cast
for (int index = 0; index < numberOfEntries; index++) {
result[index] = bag[index];
}
return result;
}
public boolean isEmpty() {
return numberOfEntries == 0;
}
public int getCurrentSize() {
return numberOfEntries;
}
/** Counts the number of times a given entry appears in this bag.
@param anEntry The entry to be counted.
@return The number of times anEntry appears in this ba. */
public int getFrequencyOf(T anEntry) {
checkIntegrity();
int counter = 0;
for (int index = 0; index < numberOfEntries; index++) {
if (anEntry.equals(bag[index])) {
counter++;
}
}
return counter;
}
/** Tests whether this bag contains a given entry.
@param anEntry The entry to locate.
@return True if this bag contains anEntry, or false otherwise. */
public boolean contains(T anEntry) {
checkIntegrity();
retu.
Can someoen help me to write c++ program including C++ inheritance, .pdfarrowvisionoptics
Can someoen help me to write c++ program including C++ inheritance, polymorphism, virtual
function, containment, file operations, and exception handling.
// Q1a: Create Dog Class
// Part 1: Create a child class of the Pet class named \'Dog\'
// See the add function in hw10.cpp for proper use of this function.
// Part2: Declare constructor which accepts the same 3 parameters as the parent class Pet.
// Pass the 3 parameters to the super constructor in the Pet class.
// Part 3: Re-declare the method display (virtual method found inside of parent class Pet)
// Q2a: Define Display for Dog class
// Define the method display that you declared within the Dog class in the header file
// Information should be printed in the following format:
// Name:
// Breed:
// Type: Dog
// (See the print_all function in hw10.cpp for proper use of this function.)
// READ BEFORE YOU START:
// You are given a partially completed program that creates a list of pets.
// Each pet has the corresponding information: name, breed, and type.
// In the Pet.h file, you will find the definition for this enum \'type\'.
// Pets on the list can be 2 different \'types\' : either a dog or a cat.
// The classes Dog and Cat are subclasses of the Pet class (found in Pet.h).
// Both of these classes will have their own use of the virtual display method.
//
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each required function and follow the directions carefully.
// If you modify any of the given code, the return types, or the parameters, you risk failing the
automated test cases.
//
// You are to assume that all input is valid:
// Valid name: String containing alphabetical letters beginning with a capital letter
// Valid breed: String containing alphabetical letters beginning with a capital letter
// All input will be a valid length and no more than the allowed amount of memory will be used
#include \"Container.h\"
#include \"Pet.h\"
#include \"Dog.h\"
#include \"Cat.h\"
#include
#include
#include
using namespace std;
// forward declarations
void flush();
void branching(char);
void helper(char);
void add_pet(string, string, Type);
Pet* search_pet(string, string, Type);
void remove_pet(string, string, Type);
void remove_all();
void print_all();
void save(string); // 10 points
void load(string); // 10 points
Container* list = NULL; // global list
int main()
{
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); // Use
to check for memory leaks in VS
load(\"Pets.txt\");
char ch = \'i\';
do {
cout << \"Please enter your selection\" << endl;
cout << \"\\ta: add a new pet to the list\" << endl;
cout << \"\\tc: change the breed of a pet\" << endl;
cout << \"\\tr: remove a pet from the list\" << endl;
cout << \"\\tp: print all pets on the list\" << endl;
cout << \"\\tq: quit and save list of pets\" << endl;
cin >> ch;
flush();
branching(ch);
} while (ch != \'q\');
save(\"Pets.txt\");
remove_all();
list = NULL;
retur.
Discuss briefly and with examples, What key measures need to be take.pdfudit652068
Discuss briefly and with examples, What key measures need to be taken in order for individuals
to promote behavior change for better health? Provide references
Solution
Answer:
The key measure are:
1. Spreading awareness for the hyegine through various communicational channels like print and
other sources of media.
2. Making health development plan for the individuals and communicating these plans to them
via the employer.
3. Making basic health care accessible to every one by introducing generic medicine in the health
care.
4. Linking the family benefits via adoption of the health care plans.
5. Advertising the better of health care vigorously..
Did BP respond in a manner that was appropriate with the oil spill t.pdfudit652068
Did BP respond in a manner that was appropriate with the oil spill to stockholders or did they
take a stakeholder view?
Solution
Ans:- BP will take stakeholder view because they are the owner, so stakeholders are needed to
give their view in oil spill.
The BP oil spill released 4.9 million barrels of oil into the Gulf of Mexico and caused a grave
amount of damage to the surrounding areas both environmentally and economically. The states
most impacted were Louisiana, Mississippi, Alabama, Texas, and Florida. The main stakeholders
in relation to the spill were the environment, wildlife, fisherman, the oil industry, and tourist-
driven businesses and communities. Directly following the spill, BP set up The Gulf Coast
Claims Facility (GCCF) which was later deemed not independent and later replaced by a court
supervised settlement program which took the subjectivity of the eligibility out of the equation.
Three years after the oil spill, BP announces that the compensation fund was running low but
they would continue to pay the settlements from their profits. Yet BP attempts to stem the flow
of incoming claims using several methods, including suing the court appointed administrator and
appealing claims. In January 2013, BP pleads guilty to 11 counts of felony manslaughter, one
count of felony obstruction of Congress, and violations of the Clear Water and Migratory Bird
Treaty Acts. BP was sentenced to pay $4 billion in fines and penalties. The Deepwater Horizon
Oil Spill has shown that the regulation for spill prevention and response are not sufficient. As the
oil companies will act in the best interest of themselves, it is the duty of the government to set
regulation in place in the interest of the health and safety of its citizens. The government needs to
act to create tighter controls on oil companies to decrease the likelihood of a repeat occurrence.
Stakeholder theory simply states that the stakeholders of a company are not just its direct owners
but that stakeholders are any person, group or entity that a corporation has “benefited or
burdened by its actions and those who benefit or burden the firm with their actions” (Steiner,
2012; Miles, 2012). The first stakeholders impacted by the Deepwater Horizon Oil Spill were the
workmen on the rig itself. When the rig exploded 126 people were on the platform, only 115
were evacuated (Cleveland, 2010). After a three day search covering 5,200 miles, the Coast
Guard called off the rescue operation stating that the period for “reasonable expectations of
survival” had passed. Sadly, the 11 presumed dead members of the crew would not be the only
ones impacted by this tragedy. Other major stakeholders include, the environment, the Gulf
fishing industry, and tourist-dependent businesses and communities.
The environment is always a stakeholder in oil spills. The environmental impact of an oil spill on
sea organisms and their ecosystems has been well-documented. The Oil Pollution Act of 1990
mandates that a N.
Describe and provide at least two examples of direct transmission of.pdfudit652068
Describe and provide at least two examples of direct transmission of communicable diseases.
Solution
Answer:
Direct transmission is the most widely recognized type of transmitting ailments and infection.
There are two kinds of direct transmission of communicable diseases: immediate and
backhanded. Coordinate direct transmission happens when there is physical direct between a
tainted individual and a vulnerable individual. Coordinate direct contaminations spread when
ailment causing microorganisms go from the tainted individual to the solid individual by means
of direct physical direct with blood or body liquids. Diseases and can be separated into:
immediate and circuitous. A case of direct transmitted microorganisms is nor viruses which are
in charge of numerous gastrointestinal contaminations.
Examples of direct transmission of communicable diseases:
Touching, kissing, sexual direct, direct with oral emissions, or direct with body injuries. Direct is
the most successive method of transmission of social insurance related.
Coordinate direct transmission requires physical direct between a contaminated individual and a
defenceless individual, and the physical exchange of microorganisms. Coordinate direct
incorporates touching a contaminated individual, kissing, sexual direct, direct with oral
emissions, or direct with body sores. This kind of transmission requires close direct with a
tainted individual, and will for the most part happen between individuals from a similar family
unit or dear loved ones.
Infections spread only by coordinate direct can\'t get by for huge timeframes far from a host.
Sexually transmitted illnesses are quite often spread through direct transmission of
communicable diseases, as they are amazingly delicate to drying.
1. Individual to-individual contact :
Irresistible ailments are regularly transmitted through direct individual to-individual direct.
Transmission happens when a contaminated individual touches or trades body liquids with
another person. This can occur before a contaminated individual knows about the sickness.
Sexually transmitted maladies (STDs) can be transmitted thusly.
2. Bead spread :
The splash of beads amid hacking and sniffling can spread an irresistible sickness. You can even
taint someone else through beads made when you talk. Since beads tumble to the ground inside a
couple of feet, this kind of transmission requires nearness.
Irresistible maladies are transmitted from individual to individual by immediate or roundabout
direct. Certain kinds of infections, microorganisms, parasites, and growths would all be able to
cause irresistible illness. Jungle fever, measles, and respiratory ailments are cases of irresistible
ailments.
Diseases are :
1. TV
2. Chickenpox
3. Tuberculosis.
Define VRIO in business strategy Define VRIO in business strat.pdfudit652068
Define VRIO in business strategy?
Define VRIO in business strategy?
Solution
VRIO stands for value, rare, imitability, and organisation. It is a supporting structure that suggest
the capability is likely to provide competetive advantage only if it viable .rare .and difficult to
follow and supported by the organisation
VRIO is a business analysis framework which forms part of larger strategic scheme.and their
will be a cost disadvantage to a organisation which is trying to develop or acquire the resources.
Define e-commerce and describe how it differs from e-business.So.pdfudit652068
Define e-commerce and describe how it differs from e-business.
Solution
Electronic commerce, commonly written as e-commerce, is the trading or facilitation of trading
in products or services using computer networks, such as the Internet. Electronic commerce
draws on technologies such as mobile commerce, electronic funds transfer, supply chain
management, Internet marketing, online transaction processing, electronic data interchange
(EDI), inventory management systems, and automated data collection systems. Modern
electronic commerce typically uses the World Wide Web for at least one part of the transaction\'s
life cycle, although it may also use other technologies such as e-mail.
E-commerce businesses may employ some or all of the following:
E-Commerce Definition
E-commerce is “any transaction completed over a computer-mediated network that involves the
transfer of ownership or rights to use goods and services,” defines the U.S. Census Bureau.
Transactions aren\'t required to have a price and include both sales and items like free
downloads. E-commerce includes transactions made on the internet, Intranet, Extranet, World
Wide Web, by email and even by fax.
E-Business Definition
E-business is broader than e-commerce; including the transaction based e-commerce businesses
and those who run traditionally but cater to online activities as well. An e-business can run any
portion of its internal processes online, including inventory management, risk management,
finance, human resources. For a business to be e-commerce and e-business, it must both sell
products online and handle other company activities or additional sales offline.
E-Commerce Types
E-commerce branches into two major groups: online purchasing and online shopping. Online
purchasing businesses offer customers the ability to find information, place orders, request
quotes or prices and submit purchase orders. Online shopping businesses provide information
about products so that consumers can make a decision whether or not to purchase a product.
Many e-commerce businesses practice online shopping and purchasing strategies to assemble an
online store.
E-Business Types And Strategy
According to E-business at Ohio State University, “E-business can work for any business
because it involves the whole business cycle from production, procurement, distribution, sales,
payment, fulfillment, restocking and marketing.” Business strategy is complicated, as it involves
four directions of planning: vertically, laterally, horizontally and downward. Vertical planning
coordinates website front and back-end systems and horizontal planning coordinates e-commerce
with customer relationships, supply-chain management and resource planning. Laterally, you
must manage customers, business partners and suppliers while at the same time integrating new
technologies and business processes downward through the organization..
Building Social Business - EssaySolutionBuilding social busine.pdfudit652068
Building Social Business - Essay
Solution
Building social business concept developed by Muhammad yunus through providing essential
facilities to the peoples of Bangladesh.
His vision of micro credit and grameen bank facilities to the people of Bangladesh, for the
practices and revolutionary concept for supporting the needy he won the Nobel peace prize in
2006.
Supporting economy and uplifting the life of peoples who are struggling for financial support.
Creating a concept of self support through producing goods and services and contributing in
nation building.
Building social business through the various channels like self help group, micro finance,
cooperative society etc.
Motivating the groups of peoples to work for their empowerment by offering essential training
and development and providing them training to produce goods and service.
Basically aim of building social business concept to provides the essential facilities to
underprivileged peoples..
You are to write a C++ program to produce an inventory repor.pdfudit652068
You are to write a C++ program to produce an inventory report for a local company. Your input
will be item name, item number, quantity, price per item, safe stock value. YOU ARE TO USE
ARRAYS AND FUNCTIONS. The output will be sent to a file. The following shows which
columns the input will be in:
item name item number quantity price safe stock
20 chars 5 char 3 char 6 chars 3 chars
Output will be as follows:
item number item name quantity price price*quantity %ofStock flag
You will put a symbol in the flag field when the inventory quantity is less than the safe stock
value.
This tells the company that they are getting too low on this item and need to build up the stock.
Print the report in sorted ordered, sorted on item number.
Indicate the total value of the stock.
Indicate the percentage of total inventory value to the total value of the highest single item in
inventory. Print the item and its information. (Print this item again at the end of the table.)
You must use the struct data structure and functions.
Use ‘typedef’ for array declarations.
Your input file will be found in invt.txt.
invt.txt looks like this:
Wong Batts 98723 243 6.45 200
Widgets No Two 83209 970 17.50 800
HumpBack Whale Songs 74329 42 23.70 50
Frozen Ice Cubes 73922 100 0.15 250
Plastic Ice Cubes 10044 450 0.60 540
Canned Solar Winds 23923 12 550.00 5
Sented Toe Jamm 18492 14 0.50 20
UnSented Toe Jam 18499 23 .74 20
Backwards Left Turns 87293 5 34.95 12
El Slick Slider 38324 15 225.00 18
Meals for Up Chuck 62042 20 16.50 24
Super House Cleaner 71083 14 69.85 18
Stars Dancing Shoes 23934 80 22.50 75
LowRider Briches 98744 138 45.95 125
HighRider Shoes 12283 372 35.95 400
Colored Pie Charts 51121 60 1.50 30
LensLess Saftey Glas 44433 22 2.10 35
Used Boat Anchors 73277 6 17.50 7
You are to write a C++ program to produce an inventory report for a local company. Your input
will be item name, item number, quantity, price per item, safe stock value. YOU ARE TO USE
ARRAYS AND FUNCTIONS. The output will be sent to a file. The following shows which
columns the input will be in:
item name item number quantity price safe stock
20 chars 5 char 3 char 6 chars 3 chars
Output will be as follows:
item number item name quantity price price*quantity %ofStock flag
You will put a symbol in the flag field when the inventory quantity is less than the safe stock
value.
This tells the company that they are getting too low on this item and need to build up the stock.
Print the report in sorted ordered, sorted on item number.
Indicate the total value of the stock.
Indicate the percentage of total inventory value to the total value of the highest single item in
inventory. Print the item and its information. (Print this item again at the end of the table.)
You must use the struct data structure and functions.
Use ‘typedef’ for array declarations.
Your input file will be found in invt.txt.
invt.txt looks like this:
Wong Batts 98723 243 6.45 200
Widgets No Two 83209 970 17.50 800
HumpBack Whale Songs.
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfudit652068
Working with Layout Managers. Notes: 1. In part 2, note that the Game class inherits from
JPanel. Therefore, the panel you are asked to add to the center of the content pane is the \"game\"
object. 2. In part 4, at the end of the function, call validate(). This is not mentioned in the book,
but it is mentioned in the framework comments.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Game extends JPanel
{
private JButton [][] squares;
private TilePuzzle game;
public Game( int newSide )
{
game = new TilePuzzle( newSide );
setUpGameGUI( );
}
public void setUpGame( int newSide )
{
game.setUpGame( newSide );
setUpGameGUI( );
}
public void setUpGameGUI( )
{
removeAll( ); // remove all components
setLayout( new GridLayout( game.getSide( ),
game.getSide( ) ) );
squares = new JButton[game.getSide( )][game.getSide( )];
ButtonHandler bh = new ButtonHandler( );
// for each button: generate button label,
// instantiate button, add to container,
// and register listener
for ( int i = 0; i < game.getSide( ); i++ )
{
for ( int j = 0; j < game.getSide( ); j++ )
{
squares[i][j] = new JButton( game.getTiles( )[i][j] );
add( squares[i][j] );
squares[i][j].addActionListener( bh );
}
}
setSize( 300, 300 );
setVisible( true );
}
private void update( int row, int col )
{
for ( int i = 0; i < game.getSide( ); i++ )
{
for ( int j = 0; j < game.getSide( ); j++ )
{
squares[i][j].setText( game.getTiles( )[i][j] );
}
}
if ( game.won( ) )
{
JOptionPane.showMessageDialog( Game.this,
\"Congratulations! You won!\ Setting up new game\" );
// int sideOfPuzzle = 3 + (int) ( 4 * Math.random( ) );
// setUpGameGUI( );
}
}
private class ButtonHandler implements ActionListener
{
public void actionPerformed( ActionEvent ae )
{
for( int i = 0; i < game.getSide( ); i++ )
{
for( int j = 0; j < game.getSide( ); j++ )
{
if ( ae.getSource( ) == squares[i][j] )
{
if ( game.tryToPlay( i, j ) )
update( i, j );
return;
} // end if
} // end inner for loop
} // outer for loop
} // end actionPerformed method
} // end ButtonHandler class
} // end Game class
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class NestedLayoutPractice extends JFrame
{
private Container contents;
private Game game;
private BorderLayout bl;
private JLabel bottom;
// ***** Task 1: declare a JPanel named top
// also declare three JButton instance variables
// that will be added to the JPanel top
// these buttons will determine the grid size of the game:
// 3-by-3, 4-by-4, or 5-by-5
// Part 1 student code starts here:
// Part 1 student code ends here.
public NestedLayoutPractice()
{
super(\"Practicing layout managers\");
contents = getContentPane();
// ***** Task 2:
// instantiate the BorderLayout manager bl
// Part 2 student code starts here:
// set the layout manager of the content pane contents to bl:
game = new Game(3); // instantiating the GamePanel object
// add panel (game) to the center of the content pane
// Part 2 student code ends here.
bottom = new JLabel(.
More Related Content
Similar to Please write the class and class with main method clearly!! This is .pdf
Ive already completed the Java assignment below, but it doesnt wor.pdffantasiatheoutofthef
I've already completed the Java assignment below, but it doesn't work. I will include my code
and the tests. Please correct my code and tests to that they match what has been asked and
reached 95% test coverage as asked for in the assignment.
Assignment: Disease File Repository
This assignment is a continuation of the last assignment. Please use the Eclipse project that you
created in the first assignment for this work.
Source Code
Class: Exposure
Copy the Exposure class from the previous assignment into the new. Make the necessary
changes so that this class can be serialized.
Class: Patient
Copy Patient class from the previous assignment into the new. Make the necessary changes so
that this class can be serialized and that it uses the Exposure class class.
Class: Disease
Copy the Disease, the InfectiousDisease, the NonInfectiousDisease classes from the previous
assignment into the new. Make the necessary changes so that they can be serialized.
Class: DiseaseAndPatient
Create a class called DiseaseAndPatient and define the follwing properties:
private Disease[] diseases;
private Patients[] patients;
Create getter and setter methods for the two arrays and document the new methods using the
Javadoc standard.
Class: DiseaseFileRepository
Create a class called DiseaseFileRepository and define the following methods:
DiseaseAndPatient init(String folderPath)
This method accepts a file path to the folder where the data was serialiaed and set the folder path
to a propert on this class. Deserialize the disease data from the file named diseases.dat.
Deserialize the patient data from the file named patients.fat. Set both the deserialized disease and
patient arrays to an instance of the DiseaseAndPatient class and return that instance. Throw an
IllegalArgumentException with an appropriate message if the supplied folder path is null.
void save(Disease[] diseases, Patient[] patients)
This method serializes and saves the supplied disease and patient array data to two separate files
on the file system using the folder path from the init method. Serialize the disease array data to a
file named disease.dat and the patient array data to the file name patients.dat.
Documentation
You are required to document the class, constructor, and methods using Javadoc standard.
Class: DiseaseFileRepositoryTest
Create a class called DiseaseFileRepositoryTest to test your DiseaseFileRespository class. You
must achieve at least 95% test coverage on the DiseaseFileRepository class.
Class: DiseaseControlManager and DiseaseControlManagerImpl
Copy the DiseaseControlManager interface and the DiseaseControlMangerImpl class from the
previous assignment and into the new. The DiseaseControlManager implementation will use the
DiseaseFileRepository class that you created in this assignment to initialize and save the disease
and patient data.
Constructor
Add a DiseaseFileRepository property to the DiseaseControlManager implementation and
initialize the property in the constructor of the D.
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdfalbarefqc
Adapt your code from Assignment 2 to use both a Java API ArrayList and a Java API LinkedList
and your new I_a (fish) objects from Assignment 3. The new program should have a main user
menu like in A2 with an added choice to print the list backwards. There should be a new
makeFish static method and a printing method similar to that in A2 renamed to printForwards
and one new method printBackwards.
Making Fish When making an I_a object in the makeFish method, instead of asking the user to
enter all the information as you did for Pokemon in A2, make a sub-menu for them to pick from
the 14 kinds of I_a implemented in A3
The only thing the user must choose is the I_a type and if they want to enter the length (or get a
random length) You should ask, Do you want to enter a length for your I'a, Y/N HINT: use
equalsIgnoreCase to simplify user input If they choose to enter the length then you will need to
ask for the length and convert the input to a double for the constructor.
You will need to try/catch for non-number and FishSizeException. This will need to loop until
you get a valid length. Finally use a switch to call the constructor for the chosen I_a. For
example: case 1: I_a ia = new Pua_ama(); or case 7: I_a ia = new PalaMoi(14.25); or case 9:I_a
ia = new Ohua(3.3));
Lists of Fish The program should have both a Java API ArrayList and LinkedList. You must
correctly declare both generic types to hold I_a objects. They should be local to the main method
(like the array in A2). Use the List interface to declare both list variables, then initialize as the
two different kinds of lists: List List1 = new ArrayList<>(); List List2 = new LinkedList<>();
Add each I_a the user makes to both lists. To add the first six I_a you can use the List Interface
add method: List.add(E element) This will add to the end (higher index) of both kinds of lists.
The allowed number of stored I_a should be limited to 6 like in the array in A2.
Don't let either List keep growing even though they can! The lists should work the same as in
A2, the 7th I_a should "wrap around" and overwrite the first I_a made (in index 0), and so on. To
overwrite existing elements using the List.set(int index, E element) method. Printing Lists The
printArray method from A2 should be renamed to printForwards, it should still be void, and
should take one parameter of type List instead of an array. The new printBackwards method will
be nearly identical, but will print a List in reverse index order: 5 4 3 2 1 0 Both methods must use
ListIterators to print the List contents. The printForwards method should get the ArrayList sent
to it from the menu choice to print the list and should print out just like the old array did,
forwards. The printBackwards method should have the LinkedList sent to it from the menu
choice to print the list backwards and should print out in REVERSE order.
HERE IS I.a java code:
import java.util.Random;
public abstract class I_a {
protected final String name;
protected final S.
Java Polymorphism: Types And Examples (Geekster)Geekster
Polymorphism is one of the 4 pillars of Object-Oriented Programming. It is a
combination of two Greek words: poly and morphs. “Poly” means “many,” and
“morphs” means “forms.” So in Java, polymorphism means many forms.
Polymorphism is defined as the ability of a message to be displayed in more than
one form.
These are the outputs which should match they are 4 of them -outp.pdfudit652068
These are the outputs which should match they are 4 of them :-
output 1 -
output 2 -
output 3 -
output 4 -
Here is the Assingment5.java file can make changes to it :-
You are required, but not limited, to turn in the following source files:
Assignment5.java (Download this file and use it as your driver program for this assignment. You
need to add more codes to complete it.)
Soup.java
SoupInBox.java
SoupInCylinder.java
SoupParser.java
Requirements to get full credits in Documentation
The assignment number, your name, StudentID, Lecture number/time, and a class description
need to be included at the top of each class/file.
A description of each method is also needed.
Some additional comments inside of methods (especially for a \"main\" method) to explain code
that are hard to follow should be written.
You can look at Java programs in the text book to see how comments are added to programs.
Skills to be Applied
In addition to what has been covered in previous assignments, the use of the following items,
discussed in class, will probably be needed:
Inheritance
The protected modifier
The super Reference
Abstract class
NumberFormat/DecimalFormat
Wrapper classes
ArrayList
Program Description
Class Diagram:
In Assignment #5, you will need to make use of inheritance by creating a class hierarchy for
vehicles.
Soup is an abstract class, which represents the basic attributes of any soup in a container to be
sold. It is used as the root of the soup hierarchy. It has the following attributes (should be
protected):
Attribute name
Attribute type
Description
volume
int
The volume of the soup
unitPrice
double
The price per unit of the soup
totalPrice
double
The total price of the soup
soupId
String
The Id of the soup
The following constructor method should be provided to initialize the instance variables.
publicSoup(String id, double someUnitPrice)
The instance variable volume is initialized to 0, totalPrice is initialized to 0.0, unitPrice is
initialized to the value of the second parameter, and soupId is initialized to the string value of the
first parameter.
The following accessor method should be provided for soupId :
publicString getSoupId()
The Class Soup also has an abstract method (which should be implemented by its child classes,
SoupInCylinder and SoupInBox) to compute the volume of the soup:
publicabstract void computeTotalPrice();
The following public method should be provided:
publicString toString()
toString method returns a string of the following format:
\ The SoupId:\\t\\ttomatosoup591\
The Volume:\\t\\t150\
The Unit Price:\\t\\t0.0015\
The Total Price:\\t$330.00\ \
You should make use of the NumberFormat class and DecimalFormat (in java.text package) to
format the total price in the dollar format (NumberFormat) and the unit price using 4 digits after
their decimal point (DecimalFormat using \"0.0000\").
SoupInCylinder class
SoupInCylinder is a subclass of Soup class. It represents a soup in a can (cylinder). It has the
following attribute in.
Code to copy:
/******************** Person.java **********************/
// Create a class Person
publicclass Person
{
// Declare variables
private String name;
private MyDate birthdate; // This is a date based on a Person\'s birthday
// Create accessor method for the name
public String getName()
{
return name;
}
// Create mutator method for name
publicvoid setName(String name)
{
this.name = name;
}
// Create accessor method for the name
public MyDate getBirthdate()
{
return birthdate;
}
// Create mutator method for name
publicvoid setBirthdate(MyDate birthdate)
{
this.birthdate = birthdate;
}
// Create a parameter constructor
public Person(String name, int pp, int kk, int vv)
{
this(name, new MyDate(pp, kk, vv));
}
// Create a parameter constructor
public Person(String name, MyDate birthday)
{
this(name);
this.birthdate = birthday;
}
// Create a parameter constructor
public Person(String name) {
this.name = name;
}
// Create to string method to display person data
@Override
public String toString() {
return \"Person [name=\" + name + \", birthdate=\" + birthdate + \"]\";
}
}
/******************** MyDate.java **********************/
// Create a class named MyDate
class MyDate
{
// Declare variables
privateint day;
privateint month;
privateint year;
// Create a default constructor
public MyDate(int month, int day, int year)
{
this.day = day;
this.month = month;
this.year = year;
}
// Create a compareTo method to compare the date objects
int compareTo(MyDate obj)
{
if(obj.day==this.day && obj.month==this.month && obj.year==this.year)
{
return 0;
}
elseif(obj.year>this.year)
{
return 1;
}
elseif(obj.year > this.year && obj.month > this.month)
{
return 1;
}
elseif(obj.year > this.year && obj.month > this.month && obj.day==this.day)
{
return 1;
}
else
return -1;
}
// Create a toString() method to display the date
@Override
public String toString()
{
return \"MyDate [day=\" + day + \", month=\" + month + \", year=\" + year + \"]\";
}
}
/******************** PersonSort.java **********************/
// import statements
import java.util.*;
import java.io.*;
// Create a class PersonSort
publicclass PersonSort implements Comparator
{
// Create compare method to compare two objects
@Override
publicint compare(Person o1, Person o2)
{
return 0;
}
// Create a main method to test the program
publicstaticvoid main(String [] args)
{
// Declare variables
String line;
String fileName=\"dataFile.txt\";
String data=\"\";
// Create a array list for the person class
ArrayList person= new ArrayList();
// Create a try block to handle the run time exceptions
try
{
// Create an object for the FileReader class
FileReader fileReader = new FileReader(fileName);
BufferedReader bufferedReader = new BufferedReader(fileReader);
// Create a for loop to read the data in the file dataFile.txt
while ((line = bufferedReader.readLine()) != null)
{
data+=line;
}
}
// Create a catch block to catch run time exceptions.
catch (FileNotFoundException ex)
{
System.out.println(\"Unable to op.
Here is the assignment5.java file -You are required, but not limi.pdfmallik3000
Here is the assignment5.java file :-
You are required, but not limited, to turn in the following source files:
Assignment5.java (Download this file and use it as your driver program for this assignment. You
need to add more codes to complete it.)
Soup.java
SoupInBox.java
SoupInCylinder.java
SoupParser.java
Requirements to get full credits in Documentation
The assignment number, your name, StudentID, Lecture number/time, and a class description
need to be included at the top of each class/file.
A description of each method is also needed.
Some additional comments inside of methods (especially for a \"main\" method) to explain code
that are hard to follow should be written.
You can look at Java programs in the text book to see how comments are added to programs.
Skills to be Applied
In addition to what has been covered in previous assignments, the use of the following items,
discussed in class, will probably be needed:
Inheritance
The protected modifier
The super Reference
Abstract class
NumberFormat/DecimalFormat
Wrapper classes
ArrayList
Program Description
Class Diagram:
In Assignment #5, you will need to make use of inheritance by creating a class hierarchy for
vehicles.
Soup is an abstract class, which represents the basic attributes of any soup in a container to be
sold. It is used as the root of the soup hierarchy. It has the following attributes (should be
protected):
Attribute name
Attribute type
Description
volume
int
The volume of the soup
unitPrice
double
The price per unit of the soup
totalPrice
double
The total price of the soup
soupId
String
The Id of the soup
The following constructor method should be provided to initialize the instance variables.
publicSoup(String id, double someUnitPrice)
The instance variable volume is initialized to 0, totalPrice is initialized to 0.0, unitPrice is
initialized to the value of the second parameter, and soupId is initialized to the string value of the
first parameter.
The following accessor method should be provided for soupId :
publicString getSoupId()
The Class Soup also has an abstract method (which should be implemented by its child classes,
SoupInCylinder and SoupInBox) to compute the volume of the soup:
publicabstract void computeTotalPrice();
The following public method should be provided:
publicString toString()
toString method returns a string of the following format:
\ The SoupId:\\t\\ttomatosoup591\
The Volume:\\t\\t150\
The Unit Price:\\t\\t0.0015\
The Total Price:\\t$330.00\ \
You should make use of the NumberFormat class and DecimalFormat (in java.text package) to
format the total price in the dollar format (NumberFormat) and the unit price using 4 digits after
their decimal point (DecimalFormat using \"0.0000\").
SoupInCylinder class
SoupInCylinder is a subclass of Soup class. It represents a soup in a can (cylinder). It has the
following attribute in addition to the inherited ones:
Attribute name
Attribute type
Description
radius
int
The radius of the cylinder of the soup.
heig.
Hello need help on this lab- what you need to do is add a code to Arra.pdfIan0J2Bondo
Hello need help on this lab, what you need to do is add a code to ArrayBag methods
equals,duplicateAll,removeDuplicates and remove according to the screenshots and then run it
with the JUnit tests present in ArrayBagTest. I will leave both programs here.
/**
A class of bags whose entries are stored in a fixed-size array.
@author Frank M. Carrano, Timothy M. Henry
* The toString method is overwritten to give a nice display of the items in
* the bag in this format Bag{Size:# [1] [2] [3] [4] }
*
* Extra methods added for lab exercise by Charles Hoot
* //- * @version 5.1
*/
public final class ArrayBag<T> implements BagInterface<T> {
private final T[] bag;
private int numberOfEntries;
private boolean integrityOK = false;
private static final int DEFAULT_CAPACITY = 25;
private static final int MAX_CAPACITY = 10000;
/** Creates an empty bag whose initial capacity is 25. */
public ArrayBag() {
this(DEFAULT_CAPACITY);
} // end default constructor
/** Creates an empty bag having a given capacity.
@param desiredCapacity The integer capacity desired. */
public ArrayBag(int desiredCapacity) {
if (desiredCapacity <= MAX_CAPACITY) {
// The cast is safe because the new array contains null entries
@SuppressWarnings("unchecked")
T[] tempBag = (T[]) new Object[desiredCapacity]; // Unchecked cast
bag = tempBag;
numberOfEntries = 0;
integrityOK = true;
// Test that contents are nulls - OK
// for (int index = 0; index < desiredCapacity; index++)
// System.out.print(bag[index] + " ");
// System.out.println();
} else
throw new IllegalStateException("Attempt to create a bag " +
"whose capacity exceeds " +
"allowed maximum.");
} // end constructor
/** Adds a new entry to this bag.
@param newEntry The object to be added as a new entry.
@return True if the addition is successful, or false if not. */
public boolean add(T newEntry) {
checkIntegrity();
boolean result = true;
if (isArrayFull()) {
result = false;
} else { // Assertion: result is true here
bag[numberOfEntries] = newEntry;
numberOfEntries++;
}
return result;
}
// public <T> T[] toArray() //OK
public T[] toArray() // OK
{
checkIntegrity();
@SuppressWarnings("unchecked")
T[] result = (T[]) new Object[numberOfEntries]; // Unchecked cast
for (int index = 0; index < numberOfEntries; index++) {
result[index] = bag[index];
}
return result;
}
public boolean isEmpty() {
return numberOfEntries == 0;
}
public int getCurrentSize() {
return numberOfEntries;
}
/** Counts the number of times a given entry appears in this bag.
@param anEntry The entry to be counted.
@return The number of times anEntry appears in this ba. */
public int getFrequencyOf(T anEntry) {
checkIntegrity();
int counter = 0;
for (int index = 0; index < numberOfEntries; index++) {
if (anEntry.equals(bag[index])) {
counter++;
}
}
return counter;
}
/** Tests whether this bag contains a given entry.
@param anEntry The entry to locate.
@return True if this bag contains anEntry, or false otherwise. */
public boolean contains(T anEntry) {
checkIntegrity();
retu.
Can someoen help me to write c++ program including C++ inheritance, .pdfarrowvisionoptics
Can someoen help me to write c++ program including C++ inheritance, polymorphism, virtual
function, containment, file operations, and exception handling.
// Q1a: Create Dog Class
// Part 1: Create a child class of the Pet class named \'Dog\'
// See the add function in hw10.cpp for proper use of this function.
// Part2: Declare constructor which accepts the same 3 parameters as the parent class Pet.
// Pass the 3 parameters to the super constructor in the Pet class.
// Part 3: Re-declare the method display (virtual method found inside of parent class Pet)
// Q2a: Define Display for Dog class
// Define the method display that you declared within the Dog class in the header file
// Information should be printed in the following format:
// Name:
// Breed:
// Type: Dog
// (See the print_all function in hw10.cpp for proper use of this function.)
// READ BEFORE YOU START:
// You are given a partially completed program that creates a list of pets.
// Each pet has the corresponding information: name, breed, and type.
// In the Pet.h file, you will find the definition for this enum \'type\'.
// Pets on the list can be 2 different \'types\' : either a dog or a cat.
// The classes Dog and Cat are subclasses of the Pet class (found in Pet.h).
// Both of these classes will have their own use of the virtual display method.
//
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each required function and follow the directions carefully.
// If you modify any of the given code, the return types, or the parameters, you risk failing the
automated test cases.
//
// You are to assume that all input is valid:
// Valid name: String containing alphabetical letters beginning with a capital letter
// Valid breed: String containing alphabetical letters beginning with a capital letter
// All input will be a valid length and no more than the allowed amount of memory will be used
#include \"Container.h\"
#include \"Pet.h\"
#include \"Dog.h\"
#include \"Cat.h\"
#include
#include
#include
using namespace std;
// forward declarations
void flush();
void branching(char);
void helper(char);
void add_pet(string, string, Type);
Pet* search_pet(string, string, Type);
void remove_pet(string, string, Type);
void remove_all();
void print_all();
void save(string); // 10 points
void load(string); // 10 points
Container* list = NULL; // global list
int main()
{
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); // Use
to check for memory leaks in VS
load(\"Pets.txt\");
char ch = \'i\';
do {
cout << \"Please enter your selection\" << endl;
cout << \"\\ta: add a new pet to the list\" << endl;
cout << \"\\tc: change the breed of a pet\" << endl;
cout << \"\\tr: remove a pet from the list\" << endl;
cout << \"\\tp: print all pets on the list\" << endl;
cout << \"\\tq: quit and save list of pets\" << endl;
cin >> ch;
flush();
branching(ch);
} while (ch != \'q\');
save(\"Pets.txt\");
remove_all();
list = NULL;
retur.
Similar to Please write the class and class with main method clearly!! This is .pdf (14)
Discuss briefly and with examples, What key measures need to be take.pdfudit652068
Discuss briefly and with examples, What key measures need to be taken in order for individuals
to promote behavior change for better health? Provide references
Solution
Answer:
The key measure are:
1. Spreading awareness for the hyegine through various communicational channels like print and
other sources of media.
2. Making health development plan for the individuals and communicating these plans to them
via the employer.
3. Making basic health care accessible to every one by introducing generic medicine in the health
care.
4. Linking the family benefits via adoption of the health care plans.
5. Advertising the better of health care vigorously..
Did BP respond in a manner that was appropriate with the oil spill t.pdfudit652068
Did BP respond in a manner that was appropriate with the oil spill to stockholders or did they
take a stakeholder view?
Solution
Ans:- BP will take stakeholder view because they are the owner, so stakeholders are needed to
give their view in oil spill.
The BP oil spill released 4.9 million barrels of oil into the Gulf of Mexico and caused a grave
amount of damage to the surrounding areas both environmentally and economically. The states
most impacted were Louisiana, Mississippi, Alabama, Texas, and Florida. The main stakeholders
in relation to the spill were the environment, wildlife, fisherman, the oil industry, and tourist-
driven businesses and communities. Directly following the spill, BP set up The Gulf Coast
Claims Facility (GCCF) which was later deemed not independent and later replaced by a court
supervised settlement program which took the subjectivity of the eligibility out of the equation.
Three years after the oil spill, BP announces that the compensation fund was running low but
they would continue to pay the settlements from their profits. Yet BP attempts to stem the flow
of incoming claims using several methods, including suing the court appointed administrator and
appealing claims. In January 2013, BP pleads guilty to 11 counts of felony manslaughter, one
count of felony obstruction of Congress, and violations of the Clear Water and Migratory Bird
Treaty Acts. BP was sentenced to pay $4 billion in fines and penalties. The Deepwater Horizon
Oil Spill has shown that the regulation for spill prevention and response are not sufficient. As the
oil companies will act in the best interest of themselves, it is the duty of the government to set
regulation in place in the interest of the health and safety of its citizens. The government needs to
act to create tighter controls on oil companies to decrease the likelihood of a repeat occurrence.
Stakeholder theory simply states that the stakeholders of a company are not just its direct owners
but that stakeholders are any person, group or entity that a corporation has “benefited or
burdened by its actions and those who benefit or burden the firm with their actions” (Steiner,
2012; Miles, 2012). The first stakeholders impacted by the Deepwater Horizon Oil Spill were the
workmen on the rig itself. When the rig exploded 126 people were on the platform, only 115
were evacuated (Cleveland, 2010). After a three day search covering 5,200 miles, the Coast
Guard called off the rescue operation stating that the period for “reasonable expectations of
survival” had passed. Sadly, the 11 presumed dead members of the crew would not be the only
ones impacted by this tragedy. Other major stakeholders include, the environment, the Gulf
fishing industry, and tourist-dependent businesses and communities.
The environment is always a stakeholder in oil spills. The environmental impact of an oil spill on
sea organisms and their ecosystems has been well-documented. The Oil Pollution Act of 1990
mandates that a N.
Describe and provide at least two examples of direct transmission of.pdfudit652068
Describe and provide at least two examples of direct transmission of communicable diseases.
Solution
Answer:
Direct transmission is the most widely recognized type of transmitting ailments and infection.
There are two kinds of direct transmission of communicable diseases: immediate and
backhanded. Coordinate direct transmission happens when there is physical direct between a
tainted individual and a vulnerable individual. Coordinate direct contaminations spread when
ailment causing microorganisms go from the tainted individual to the solid individual by means
of direct physical direct with blood or body liquids. Diseases and can be separated into:
immediate and circuitous. A case of direct transmitted microorganisms is nor viruses which are
in charge of numerous gastrointestinal contaminations.
Examples of direct transmission of communicable diseases:
Touching, kissing, sexual direct, direct with oral emissions, or direct with body injuries. Direct is
the most successive method of transmission of social insurance related.
Coordinate direct transmission requires physical direct between a contaminated individual and a
defenceless individual, and the physical exchange of microorganisms. Coordinate direct
incorporates touching a contaminated individual, kissing, sexual direct, direct with oral
emissions, or direct with body sores. This kind of transmission requires close direct with a
tainted individual, and will for the most part happen between individuals from a similar family
unit or dear loved ones.
Infections spread only by coordinate direct can\'t get by for huge timeframes far from a host.
Sexually transmitted illnesses are quite often spread through direct transmission of
communicable diseases, as they are amazingly delicate to drying.
1. Individual to-individual contact :
Irresistible ailments are regularly transmitted through direct individual to-individual direct.
Transmission happens when a contaminated individual touches or trades body liquids with
another person. This can occur before a contaminated individual knows about the sickness.
Sexually transmitted maladies (STDs) can be transmitted thusly.
2. Bead spread :
The splash of beads amid hacking and sniffling can spread an irresistible sickness. You can even
taint someone else through beads made when you talk. Since beads tumble to the ground inside a
couple of feet, this kind of transmission requires nearness.
Irresistible maladies are transmitted from individual to individual by immediate or roundabout
direct. Certain kinds of infections, microorganisms, parasites, and growths would all be able to
cause irresistible illness. Jungle fever, measles, and respiratory ailments are cases of irresistible
ailments.
Diseases are :
1. TV
2. Chickenpox
3. Tuberculosis.
Define VRIO in business strategy Define VRIO in business strat.pdfudit652068
Define VRIO in business strategy?
Define VRIO in business strategy?
Solution
VRIO stands for value, rare, imitability, and organisation. It is a supporting structure that suggest
the capability is likely to provide competetive advantage only if it viable .rare .and difficult to
follow and supported by the organisation
VRIO is a business analysis framework which forms part of larger strategic scheme.and their
will be a cost disadvantage to a organisation which is trying to develop or acquire the resources.
Define e-commerce and describe how it differs from e-business.So.pdfudit652068
Define e-commerce and describe how it differs from e-business.
Solution
Electronic commerce, commonly written as e-commerce, is the trading or facilitation of trading
in products or services using computer networks, such as the Internet. Electronic commerce
draws on technologies such as mobile commerce, electronic funds transfer, supply chain
management, Internet marketing, online transaction processing, electronic data interchange
(EDI), inventory management systems, and automated data collection systems. Modern
electronic commerce typically uses the World Wide Web for at least one part of the transaction\'s
life cycle, although it may also use other technologies such as e-mail.
E-commerce businesses may employ some or all of the following:
E-Commerce Definition
E-commerce is “any transaction completed over a computer-mediated network that involves the
transfer of ownership or rights to use goods and services,” defines the U.S. Census Bureau.
Transactions aren\'t required to have a price and include both sales and items like free
downloads. E-commerce includes transactions made on the internet, Intranet, Extranet, World
Wide Web, by email and even by fax.
E-Business Definition
E-business is broader than e-commerce; including the transaction based e-commerce businesses
and those who run traditionally but cater to online activities as well. An e-business can run any
portion of its internal processes online, including inventory management, risk management,
finance, human resources. For a business to be e-commerce and e-business, it must both sell
products online and handle other company activities or additional sales offline.
E-Commerce Types
E-commerce branches into two major groups: online purchasing and online shopping. Online
purchasing businesses offer customers the ability to find information, place orders, request
quotes or prices and submit purchase orders. Online shopping businesses provide information
about products so that consumers can make a decision whether or not to purchase a product.
Many e-commerce businesses practice online shopping and purchasing strategies to assemble an
online store.
E-Business Types And Strategy
According to E-business at Ohio State University, “E-business can work for any business
because it involves the whole business cycle from production, procurement, distribution, sales,
payment, fulfillment, restocking and marketing.” Business strategy is complicated, as it involves
four directions of planning: vertically, laterally, horizontally and downward. Vertical planning
coordinates website front and back-end systems and horizontal planning coordinates e-commerce
with customer relationships, supply-chain management and resource planning. Laterally, you
must manage customers, business partners and suppliers while at the same time integrating new
technologies and business processes downward through the organization..
Building Social Business - EssaySolutionBuilding social busine.pdfudit652068
Building Social Business - Essay
Solution
Building social business concept developed by Muhammad yunus through providing essential
facilities to the peoples of Bangladesh.
His vision of micro credit and grameen bank facilities to the people of Bangladesh, for the
practices and revolutionary concept for supporting the needy he won the Nobel peace prize in
2006.
Supporting economy and uplifting the life of peoples who are struggling for financial support.
Creating a concept of self support through producing goods and services and contributing in
nation building.
Building social business through the various channels like self help group, micro finance,
cooperative society etc.
Motivating the groups of peoples to work for their empowerment by offering essential training
and development and providing them training to produce goods and service.
Basically aim of building social business concept to provides the essential facilities to
underprivileged peoples..
You are to write a C++ program to produce an inventory repor.pdfudit652068
You are to write a C++ program to produce an inventory report for a local company. Your input
will be item name, item number, quantity, price per item, safe stock value. YOU ARE TO USE
ARRAYS AND FUNCTIONS. The output will be sent to a file. The following shows which
columns the input will be in:
item name item number quantity price safe stock
20 chars 5 char 3 char 6 chars 3 chars
Output will be as follows:
item number item name quantity price price*quantity %ofStock flag
You will put a symbol in the flag field when the inventory quantity is less than the safe stock
value.
This tells the company that they are getting too low on this item and need to build up the stock.
Print the report in sorted ordered, sorted on item number.
Indicate the total value of the stock.
Indicate the percentage of total inventory value to the total value of the highest single item in
inventory. Print the item and its information. (Print this item again at the end of the table.)
You must use the struct data structure and functions.
Use ‘typedef’ for array declarations.
Your input file will be found in invt.txt.
invt.txt looks like this:
Wong Batts 98723 243 6.45 200
Widgets No Two 83209 970 17.50 800
HumpBack Whale Songs 74329 42 23.70 50
Frozen Ice Cubes 73922 100 0.15 250
Plastic Ice Cubes 10044 450 0.60 540
Canned Solar Winds 23923 12 550.00 5
Sented Toe Jamm 18492 14 0.50 20
UnSented Toe Jam 18499 23 .74 20
Backwards Left Turns 87293 5 34.95 12
El Slick Slider 38324 15 225.00 18
Meals for Up Chuck 62042 20 16.50 24
Super House Cleaner 71083 14 69.85 18
Stars Dancing Shoes 23934 80 22.50 75
LowRider Briches 98744 138 45.95 125
HighRider Shoes 12283 372 35.95 400
Colored Pie Charts 51121 60 1.50 30
LensLess Saftey Glas 44433 22 2.10 35
Used Boat Anchors 73277 6 17.50 7
You are to write a C++ program to produce an inventory report for a local company. Your input
will be item name, item number, quantity, price per item, safe stock value. YOU ARE TO USE
ARRAYS AND FUNCTIONS. The output will be sent to a file. The following shows which
columns the input will be in:
item name item number quantity price safe stock
20 chars 5 char 3 char 6 chars 3 chars
Output will be as follows:
item number item name quantity price price*quantity %ofStock flag
You will put a symbol in the flag field when the inventory quantity is less than the safe stock
value.
This tells the company that they are getting too low on this item and need to build up the stock.
Print the report in sorted ordered, sorted on item number.
Indicate the total value of the stock.
Indicate the percentage of total inventory value to the total value of the highest single item in
inventory. Print the item and its information. (Print this item again at the end of the table.)
You must use the struct data structure and functions.
Use ‘typedef’ for array declarations.
Your input file will be found in invt.txt.
invt.txt looks like this:
Wong Batts 98723 243 6.45 200
Widgets No Two 83209 970 17.50 800
HumpBack Whale Songs.
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfudit652068
Working with Layout Managers. Notes: 1. In part 2, note that the Game class inherits from
JPanel. Therefore, the panel you are asked to add to the center of the content pane is the \"game\"
object. 2. In part 4, at the end of the function, call validate(). This is not mentioned in the book,
but it is mentioned in the framework comments.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Game extends JPanel
{
private JButton [][] squares;
private TilePuzzle game;
public Game( int newSide )
{
game = new TilePuzzle( newSide );
setUpGameGUI( );
}
public void setUpGame( int newSide )
{
game.setUpGame( newSide );
setUpGameGUI( );
}
public void setUpGameGUI( )
{
removeAll( ); // remove all components
setLayout( new GridLayout( game.getSide( ),
game.getSide( ) ) );
squares = new JButton[game.getSide( )][game.getSide( )];
ButtonHandler bh = new ButtonHandler( );
// for each button: generate button label,
// instantiate button, add to container,
// and register listener
for ( int i = 0; i < game.getSide( ); i++ )
{
for ( int j = 0; j < game.getSide( ); j++ )
{
squares[i][j] = new JButton( game.getTiles( )[i][j] );
add( squares[i][j] );
squares[i][j].addActionListener( bh );
}
}
setSize( 300, 300 );
setVisible( true );
}
private void update( int row, int col )
{
for ( int i = 0; i < game.getSide( ); i++ )
{
for ( int j = 0; j < game.getSide( ); j++ )
{
squares[i][j].setText( game.getTiles( )[i][j] );
}
}
if ( game.won( ) )
{
JOptionPane.showMessageDialog( Game.this,
\"Congratulations! You won!\ Setting up new game\" );
// int sideOfPuzzle = 3 + (int) ( 4 * Math.random( ) );
// setUpGameGUI( );
}
}
private class ButtonHandler implements ActionListener
{
public void actionPerformed( ActionEvent ae )
{
for( int i = 0; i < game.getSide( ); i++ )
{
for( int j = 0; j < game.getSide( ); j++ )
{
if ( ae.getSource( ) == squares[i][j] )
{
if ( game.tryToPlay( i, j ) )
update( i, j );
return;
} // end if
} // end inner for loop
} // outer for loop
} // end actionPerformed method
} // end ButtonHandler class
} // end Game class
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class NestedLayoutPractice extends JFrame
{
private Container contents;
private Game game;
private BorderLayout bl;
private JLabel bottom;
// ***** Task 1: declare a JPanel named top
// also declare three JButton instance variables
// that will be added to the JPanel top
// these buttons will determine the grid size of the game:
// 3-by-3, 4-by-4, or 5-by-5
// Part 1 student code starts here:
// Part 1 student code ends here.
public NestedLayoutPractice()
{
super(\"Practicing layout managers\");
contents = getContentPane();
// ***** Task 2:
// instantiate the BorderLayout manager bl
// Part 2 student code starts here:
// set the layout manager of the content pane contents to bl:
game = new Game(3); // instantiating the GamePanel object
// add panel (game) to the center of the content pane
// Part 2 student code ends here.
bottom = new JLabel(.
Write a java program that would ask the user to enter an input file .pdfudit652068
Write a java program that would ask the user to enter an input file name, and an output file name.
Then the program reads the content of the input file, and then writes the content of the input file
to the output file with each line proceeded with a line number followed by a colon. The line
numbering should start at 1.
should be used the following technique
(a) while loop should be used to complete the program.
(b)Scanner classisused
(c) PrintWriter class is used
(d) The files are closed before the program terminates.
ExampleOriginal Input fileOutput file with line number added1341: 1341252: 1251123:
1121894: 189
Solution
FileCopier.java:-
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
public class FileCopier {
public static void main(String[] args) throws IOException{
Scanner in=new Scanner(System.in);
System.out.println(\"Enter input file\");
File inputFile=new File(in.nextLine());
if(!inputFile.exists()){
System.out.println(\"Source file doesn\'t exist\");
System.exit(0);
}
FileInputStream fis=new FileInputStream(inputFile);
System.out.println(\"Enter output file\");
FileWriter fw=new FileWriter(in.nextLine());
PrintWriter pw=new PrintWriter(fw);
in=new Scanner(inputFile);
int i=1;
while(in.hasNextLine()){
String s=in.nextLine();
pw.write(i++ + \": \" + s + \"\ \");
}
pw.flush();pw.close();
}
}
Console output:
Enter input file
test.txt
Enter output file
output.txt
Sample run 1:-
test.txt:
hey
123
.
howdy
output.txt:
1: hey
2: 123
3: .
4: howdy
Sample run 2:-
test.txt:
123
345
567
789
output.txt
1: 123
2: 345
3: 567
4: 789.
Which of the following defines a method doubleEach that returns an ar.pdfudit652068
Which of the following defines a method doubleEach that returns an array where each element
is double the corresponding element in an input array? public double[] doubleEach(double[]
input) {double[] temp = new double[input.length]; for (int i = 0; i
Solution
Answer is A
public double[] dobleEach(double [] input)
{
double[] temp= new double[input.length];
for(int i=0;i.
When the Fed provides more reserves toprovides more reserves to.pdfudit652068
When the Fed
provides more reserves toprovides more reserves to
the banking system, the money banks have to lend to each other
falls
rises
,
and the federal fund rate
rises
falls
.
Solution
When the Fed provides more reserves to the banking system, the money banks have to lend to
each other rises and the federal fund rate falls. (due to increase in money supply).
What is a common infrastructure and what does it provideSolutio.pdfudit652068
What is a common infrastructure and what does it provide?
Solution
Ans.
Common Infrastructure is the definition of service providers or users of Information and
Communications Technologies which share the systems used to distribute electronic
communication signals and services.
It provides services which are required by the larger sections of the society such as airports,
stations, large databases etc...
What are the eukaryotic kingdomsQuestion 4 optionsBacteria, Ar.pdfudit652068
What are the eukaryotic kingdoms?
Question 4 options:
Bacteria, Archae
Phylum, Class, Order
Eukarya, Archaea, Bacteria
Protists, Fungi, Plants, Animals
Bacteria, Archae
Phylum, Class, Order
Eukarya, Archaea, Bacteria
Protists, Fungi, Plants, Animals
Solution
Ans d protista fungi planta animalia
All other options have one or more prokaryote. Organisms are divided into 3 major domains,
archae, bacteria and eukaryota. Eukaryota is then divided into 4 kingdoms.
What are some of the commonly seen WLAN devices What role does each.pdfudit652068
What are some of the commonly seen WLAN devices? What role does each of them play in
creating the WLAN network infrastructure?
Solution
What are some of the commonly seen WLAN devices?
Ans:Access Point(AP),Bridges,Switch,Router,Gateway,Hub
Access Point(AP):It connects wireless devices.It allows to user to have an access of network for
communication.
Bridege:It is used to connect network of different types.E.g.Ethernet bridge connects wired
Ethernet network to wireless network.
Switch:It allows to connect devices among each other using method of packet switching for
send,receive and process of data.
Router:It allows to forward packets from one computer to another.It does job of traffic
management of network.
Gateway:It is used to coonect to another network which uses another protocol.It routes traffic
from inside of network to outside.
Hub:It is common point where all devices are connected.In this hub,frame of data is broadcasted
to each device.It doesnt matter whether frame is for particular computer or device.It just
broadcasts..
Using the header(dlist) and mainline file (dlistapp) belowYou are .pdfudit652068
Using the header(dlist) and mainline file (dlistapp) below
You are going to write public functions for a doubly linked list class.
The dlist class is declared in the file dlist.h as follows:
struct dlist_node
{
char contents; // contents in the node
dlist_node *back, // pointer to previous node in the list
*next; // pointer to the next node in the list
};
typedef dlist_node* dptr;
class dlist
{
private:
dptr front, // pointer to the front of the list
current; // pointer to current node in the list
public:
dlist (); // constructor creates an empty list
void insert (char ch); // inserts a new node
void remove (); // removes a node
void Move_Right(int distance); // moves current right
void Move_Left(int distance); // moves current left
void print (); // prints the list
};
The public functions that you need to define are:
dlist (): Constructor that initializes the list to be empty.
voidinsert (char ch): Adds a new node to the right of current containing ch and points current at
the new node. Should insert first node correctly.
void remove (): Removes the node from the list pointed to by current. Points current at the node
after the deleted node (if present) else points current at the node before the deleted node (if
present). Should remove last node correctly and recycle nodes. Should not fail if list is empty.
void Move_Right (int distance): Moves current to the right distance nodes. If the given distance
will move current off the end of the list, current should be set to point at the rightmost node.
Should not fail if list is empty.
void Move_Left (int distance): Moves current to the left distance nodes. If the given distance will
move current off the end of the list, current should be set to point at the leftmost node. Should
not fail if list is empty.
void print (): Prints all the nodes in the list. The value pointed to by current should be printed in
braces.print does not output any spaces or linefeeds. For example, if the data in the linklist
represents CIS 361, the output would be :
CIS 3{6}1
The dlistapp.cpp application file is coded except for the calls to the public functions. Add the
calls as directed by the comments in the file.
dlist.h
dlistapp.cpp
Sample run
Select p (print), i (insert), d (delete), r (right),
l (left) or q (quit): d
Select p (print), i (insert), d (delete), r (right),
l (left) or q (quit): r
Enter the distance to move right: 10
Select p (print), i (insert), d (delete), r (right),
l (left) or q (quit): l
Enter the distance to move left: 2
Select p (print), i (insert), d (delete), r (right),
l (left) or q (quit): p
The list is:
Select p (print), i (insert), d (delete), r (right),
l (left) or q (quit): i
Enter the character to insert: h front current
Solution
#include
using namespace std;
struct dlist_node
{
char contents; // contents in the node
dlist_node *back, // pointer to previous node in the list
*next; // pointer to the next node in the list
};
typedef dlist_node* dptr;
class dlist
{
private:
dptr front, // po.
Virology.Explain the make up and role of different complexes for .pdfudit652068
Virology.
Explain the make up and role of different complexes: for example the components of the
spliceosome made up and its role.
Solution
Answer=1]
components of spliceosome made up &its roles
Spliceosome is large & compex molecular machine
assembled from snRNAs & protein complexes
1] sn RNAs = it is composed of 5 small nuclear RNAs
are U1,U2,U4,U5 ,U6
Roles - they participate in most RNA -RNA & RNA -Protein interactions
2] associated protein factors = snRNPs or small nuclear ribonucleoproteins
are RNA protein complexes that combine with unmodified mRNA & various other proteins to
form spliceosome
2] Multiprotein complex = is a group of 2 or more associated polypeptide chains
example -proteasome - important for molecular degradation
3] Major histocompatibility compex (MHC )=set of cell surface proteins
role- to bind antigen derived from pathogens & display them on the call surface for recognition
by appropriate T cells.
TOPOLOGY 541Let M be a set with two members a and b. Define the fu.pdfudit652068
TOPOLOGY 541
Let M be a set with two members a and b. Define the function D : M × M as follows: D(a,a) =
D(b,b) = 0,D(a,b) = D(b,a) = r where r is a positive real number. Prove that (M, D) is a metric
space.
Solution
Definition 1.1 (Metric). A metric, or distance function, on a set X is a mapping d : X × X R such
that • d(x, y) 0 for all x, y X, and d(x, y) = 0 if and only if x = y. • d(x, y) = d(y, x) for all x, y
X. • d(x, z) d(x, y) + d(y, z) for all x, y, z X. We call (X, d) a metric space. Definition 1.2 (Open
ball). Let (X, d) be a metric space. For x X and > 0, the set Bd(x, ) defined by Bd(x, ) = {y X |
d(x, y) < } is callen an open ball in the set X. Definition 1.3 (Open sets in metric spaces). Let (X,
d) be a metric space and let U be any subset of X. Then U is called an open set in X if every
point of U is an interior point of U; that is, for any a U, there is an open ball B(a, ) such that B(a,
) U. Definition 1.4 (Properties of open sets). Let (X, d) be a metric space. • and X are open. •
The union of an arbitrary collection of open sets is open. • The intersection of a finite number of
open sets is open. Definition 1.5 (Closed set). A subset A of a metric space (X, d) is closed if it’s
complement X\\A is open in X. Definition 1.6 (Properties of closed sets). Let (X, d) be a metric
space. • and X are closed. • The union of an finite collection of closed sets is closed. • The
intersection of an arbitrary number of closed sets is closed. Definition 1.7 (Limit point of a
subset). Let (X, d) be a metric space and let A be a subset of X. Then a point x in X is a limit
point of A if every open ball B(x, ) contains at least one point of A. The set of all limit points of
A is called the derived set A . Definition 1.8 (Closure of a set). Let (X, d) be a metric space and
let A X. Then the set consisting of A and its limit points is called the closure of A, denoted A. A
= A A
Corollary 1.19. We note that A is dense in X if and only if for any x X and > 0, there is a point
a A such that d(x, a) < . 1.2. Subspaces. Definition 1.20 (Open sets in a subspace). Let (X, d) be
a metric space and (Y, dY ) be a metric subspace of (X, d). Let G be a subset of Y . Then G is
open in Y if and only if, for any x G, there is an open ball B(x, ) in X such that B(x, ) Y G A
subset H of Y is closed in Y if its complement G = Y \\H of H is open in Y . Theorem 1.21
(Open sets in a metric subspace). Let (Y, dY ) be a metric subspace of a metric space (X, d), and
let G Y . Then G is open in Y if and only if there exists an open subset U in X such that G = U
Y . 1.3. Convergence in a Metric Space. Definition 1.22 (Convergence). A sequence (xn) in a
metric space (X, d) is said to converge to a point x X if for any > 0, there exists N such that n >
N implies d(xn, x) < The point x is called a limit of the sequence (xn) Corollary 1.23. A
sequence (xn) in a metric space (X, d) is said to converge to a point x X if any open ball B(x, )
contains almost all xn. Theorem 1..
The test solution is made basic and drops of 0.1 M Ca(NO3)2 are adde.pdfudit652068
The test solution is made basic and drops of 0.1 M Ca(NO3)2 are added but no precipitate forms.
To what part of the experiment Procedure do you proceed?
Solution
procedure of adding Ca2+ to precipitates phosphates or carbonates before doint test for halides
and sulphide. but since precipitate not formed means carbonates are not present so go for the test
off halides( Cl- , Br-, I-)..
The selection of officials in which of the following branches of the.pdfudit652068
The selection of officials in which of the following branches of the national government is least
consistent with the ideal of democracy, or popular sovereignty?
The
The
The
The
d
A. the judiciary
B. The executive
C. The legislature
d. The federalaa.
TheB.
TheC.
The
The
d
A. the judiciary
B. The executive
C. The legislature
d. The federal
Solution
WHAT ARE THE ESSENTIAL CHARACTERISTICS AND PRINCIPLES OF
CONSTITUTIONAL DEMOCRACY?
CONSTITUTIONAL DEMOCRACY is the antithesis of arbitrary rule. It is democracy
characterized by:
A. POPULAR SOVEREIGNTY. The people are the ultimate source of the authority of the
government which derives its right to govern from their consent.
B. MAJORITY RULE AND MINORITY RIGHTS. Although \"the majority rules,\" the
fundamental rights of individuals in the minority are protected.
C. LIMITED GOVERNMENT. The powers of government are limited by law and a written or
unwritten constitution which those in power obey.
D. INSTITUTIONAL AND PROCEDURAL LIMITATIONS ON POWERS. There are certain
institutional and procedural devices which limit the powers of government. These may include:
1. SEPARATED AND SHARED POWERS. Powers are separated among different agencies or
branches of government. Each agency or branch has primary responsibility for certain functions
such as legislative, executive, and judicial functions. However, each branch also shares these
functions with the other branches.
2. CHECKS AND BALANCES. Different agencies or branches of government have adequate
power to check the powers of other branches. Checks and balances may include the power of
judicial reviewÀ\"Àthe power of courts to declare actions of other branches of government to be
contrary to the constitution and therefore null and void.
3. DUE PROCESS OF LAW. Individual rights to life, liberty, and property are protected by the
guarantee of due process of law.
4. LEADERSHIP SUCCESSION THROUGH ELECTIONS. Elections insure that key positions
in government will be contested at periodic intervals and that the transfer of governmental
authority is accomplished in a peaceful and orderly process.
C. The legislature.
the distance between the N-terminal and C-ternimal amino acids varie.pdfudit652068
the distance between the N-terminal and C-ternimal amino acids varies from random polymers
02= root 2L where r is the radius of the polymer and L is the length in number of monomers by--
-----?
A. By just the random walk mathematics
B the alpha helicies
C the beta sheets.
D all of above
E B and C only
The answer is not E
Solution
Ans) A. By just the random walk mathematics.
Fundamental of all proteins familiar to crease kinetically in a both-state process have their N-
and C-terminal subordinate structural component in communication, and the terminal
components often dock as fragment of the exploratory measurable beginning folding step..
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Please write the class and class with main method clearly!! This is .pdf
1. Please write the class and class with main method clearly!! This is to be written in JAVA.
Step 1 Develop the following class:
Class
Name: Bag
Access Modifier: public
Instance variables
1-Name: name
Access modifier: private
Data Type: String
2-Name: currentWeight
Access modifier: private
Data Type: double
3-Name: maximumWeight
Access modifier: private
Data Type: double
Constructors
Name: Bag
Access modifier: public
Parameters: none (default constructor)
Task: sets the value of the instance variable name to the empty string sets the value of the
instance variable currentWeight to 0.0 sets the value of the instance variable maximumWeight to
5.0
Methods
Name: setName
Access modifier: public
Parameters: newName
Return Type: void
Task: sets the value of the instance variable name to newName
Name: getName
Access modifier: public
Parameters: none
Return Type: String
Task: returns the value of the instance variable name
Name: addItem
Access modifier: public
2. Parameters: newWeight Return
Type: void
Task: sets the value of the instance variable currentWeight equal to the value of currentWeight
plus the value of newWeight if the value of newWeight is greater than 0 and if the value of
currentWeight plus the value of newWeight is less than or equal to the value of the instance
variable maximumWeight
Name: getCurrentWeight
Access modifier: public
Parameters: none
Return Type: double
Task: returns the value of the instance variable currentWeight
Name: setMaximumWeight
Access modifier: public
Parameters: newMaximumWeight
Return Type: void
Task: sets the value of the instance variable maximumWeight to value of the
newMaximumWeight if newMaximumWeight is greater than 0 and greater than or equal to the
value of the instance variable currentWeight
Name: getMaximumWeight
Access modifier: public
Parameters: none
Return Type: double
Task: returns the value of the instance variable maximumWeight
Step 2
Develop a class with only a main method in it:
import java.util.Scanner;
public class BagDemo {
public static void main(String[] args) {
//Create a Scanner object called keyboard that takes input from //System.in //Create an object of
the Bag class refer to this object as myBag //declare a variable called option of type int //Open a
do/while loop //Prompt the user to pick one of the following options: //Press 1 to change the
name of the bag //Press 2 to add an item to the bag //Press 3 to change the maximum weight of
the bag //Press 4 to view all information about the bag //Press 5 to end the program //Save the
user’s input into the option variable //if the user picks option 1, prompt the user for the name of
the bag //then save the name of the bag in a variable called newName //change the name of the
bag to newName //else if the user picks option 2, prompt the user for the weight //of the item and
3. then save the weight of the item in a variable //called newWeight //add the new item to the bag
//else if the user picks option 3, prompt the user for the new maximum //weight of the bag and
save the new maximum weight in a variable //called newMaximumWeight //change the
maximum weight of the bag to newMaximumWeight //else if the user picks option 4, display to
the screen the name of //the bag, the current weight of the bag, and the maximum weight //of the
bag //else if the user picks option 5, display Goodbye. //else if the user picks any other option,
display Error! //close the do/while loop and make it so that it continues to run as //long as the
user does not pick option 5 } }
Solution
HI, Please find my implementation.
Please let me know in case of any issue.
############### Bag.java ########################
public class Bag {
// instance variables
private String name;
private double currentWeight;
private double maximumWeight;
// constructor
public Bag() {
name = "";
currentWeight = 0.0;
maximumWeight = 5.0;
}
public void setName(String newName){
name = newName;
}
public String getName(){
return name;
}
4. public void addItem(double newWeight){
double total = currentWeight + newWeight;
if(newWeight > 0 && total <= maximumWeight)
currentWeight = total;
}
public double getCurrentWeight(){
return currentWeight;
}
public void setMaximumWeight(double newMaximumWeight){
if(newMaximumWeight >0 && (currentWeight <= newMaximumWeight))
maximumWeight = newMaximumWeight;
}
public double getMaximumWeight(){
return maximumWeight;
}
}
############### BagDemo.java ###############
import java.util.Scanner;
public class BagDemo {
public static void main(String[] args) {
//Create a Scanner object called keyboard that takes input from //System.in
Scanner sc = new Scanner(System.in);
//Create an object of the Bag class refer to this object as myBag
Bag myBag = new Bag();
//declare a variable called option of type int
int option;
//Open a do/while loop //Prompt the user to pick one of the following options:
//Press 1 to change the name of the bag
//Press 2 to add an item to the bag
//Press 3 to change the maximum weight of the bag
//Press 4 to view all information about the bag
//Press 5 to end the program
5. do{
System.out.println("Press 1 to change the name of the bag");
System.out.println("Press 2 to add an item to the bag ");
System.out.println("Press 3 to change the maximum weight of the bag ");
System.out.println("Press 4 to view all information about the bag");
System.out.println("Press 5 to end the program ");
//Save the user’s input into the option variable
option = sc.nextInt();
//if the user picks option 1, prompt the user for the name of the bag
//then save the name of the bag in a variable called newName
//change the name of the bag to newName
if(option == 1){
System.out.print("Enter name: ");
String newName = sc.next();
myBag.setName(newName);
}
//else if the user picks option 2, prompt the user for the weight
//of the item and then save the weight of the item in a variable
//called newWeight //add the new item to the bag
else if(option == 2){
System.out.print("Enter weight of the item: ");
double newWeight = sc.nextDouble();
myBag.addItem(newWeight);
}
//else if the user picks option 3, prompt the user for the new maximum
//weight of the bag and save the new maximum weight in a variable
//called newMaximumWeight //change the maximum weight of the bag to
newMaximumWeight
else if(option == 3){
System.out.print("Enter new max weight: ");
double newMaximumWeight = sc.nextDouble();
myBag.setMaximumWeight(newMaximumWeight);
}
//else if the user picks option 4, display to the screen the name of
//the bag, the current weight of the bag, and the maximum weight
//of the bag
6. else if(option == 4){
System.out.println("Name: "+myBag.getName());
System.out.println("Current Weight: "+myBag.getCurrentWeight());
System.out.println("Max Weight: "+myBag.getMaximumWeight());
}
//else if the user picks option 5, display Goodbye.
else if(option == 5){
System.out.println("Goodbye");
}
//else if the user picks any other option, display Error!
//close the do/while loop and make it so that it continues to run as
//long as the user does not pick option 5
else{
System.out.println("Invalid option!!!");
}
}while(option != 5);
}
}
/*
Sample run:
Press 1 to change the name of the bag
Press 2 to add an item to the bag
Press 3 to change the maximum weight of the bag
Press 4 to view all information about the bag
Press 5 to end the program
1
Enter name: AmericalTourist
Press 1 to change the name of the bag
Press 2 to add an item to the bag
Press 3 to change the maximum weight of the bag
Press 4 to view all information about the bag
Press 5 to end the program
2
Enter weight of the item: 34
Press 1 to change the name of the bag
Press 2 to add an item to the bag
7. Press 3 to change the maximum weight of the bag
Press 4 to view all information about the bag
Press 5 to end the program
3
Enter new max weight: 50
Press 1 to change the name of the bag
Press 2 to add an item to the bag
Press 3 to change the maximum weight of the bag
Press 4 to view all information about the bag
Press 5 to end the program
2
Enter weight of the item: 34
Press 1 to change the name of the bag
Press 2 to add an item to the bag
Press 3 to change the maximum weight of the bag
Press 4 to view all information about the bag
Press 5 to end the program
4
Name: AmericalTourist
Current Weight: 34.0
Max Weight: 50.0
Press 1 to change the name of the bag
Press 2 to add an item to the bag
Press 3 to change the maximum weight of the bag
Press 4 to view all information about the bag
Press 5 to end the program
5
Goodbye
*/