Questions
In Java language. Write a brief program that writes your name to a file in text...

In Java language. Write a brief program that writes your name to a file in text format and then reads it back. Use the PrintWriter and Scanner classes.

In: Computer Science

A spherical steel ball bearing has a diameter of 2.540 cm at 29.00°C. (Assume the coefficient...

A spherical steel ball bearing has a diameter of 2.540 cm at 29.00°C. (Assume the coefficient of linear expansion for steel is 11 ✕ 10−6 (°C)−1. )

(a) What is its diameter when its temperature is raised to 96.0°C? (Give your answer to at least four significant figures.) cm

(b) What temperature change is required to increase its volume by 0.800%?

In: Physics

You are required to write an interactive program that prompts the user for ten (10) real...

You are required to write an interactive program that prompts the user for ten (10) real numbers and performs the following tasks:

  1. Reads and stores the numbers into one-dimensional array called A. The program must use a function to perform this task.
  2. Prints the content of the array. Write a function to perform this task.
  3. Calculates the sum of the numbers. Use a function to perform this task.
  4. Find the average of the numbers. Utilize a function to perform this task.
  5. Prints the sum and the average. Write a function that receives these values and print them.

Program requirements:

-     The program must utilize a class, an object and all the necessary functions to perform the above tasks.

-     The program must be fully documented.

-    You must submit a hard copy of the source and a properly labeled output.

-     You should submit a digital copy of source code.

-     Test your program for different values using real numbers.

In: Computer Science

A state is divided into R*C cities.The government has launched an initiative to find the cities...

A state is divided into R*C cities.The government has launched an initiative to find the cities which are dominated by coders. Each city may or may not have coders residing in it. If the city is dominated by coders, it is marked with 1 else it is marked with 0. Two cities are termed as connected cities if they both are dominated by coders and can be reached by moving vertically, horizontally, or diagonally.

Example:
The given is the state with 3*3 cities and their dominance representation.
City[1, 1] is directly connected to City[1, 2].
City[1, 2] is directly connected to City[1, 1], City[1, 3] and City[2, 3].
City[1, 3] is directly connected to City[1, 2] and City[2, 3].
City[2, 3] is directly connected to City[1, 2] and City[1, 3].
City[3, 1] is not connected to any of the other coder dominant cities.
One or more coder dominant connected cities form the Coding belt. In a belt, there may be coder dominant cities which are not directly connected but can be reached by moving through other dominant cities. It is possible that there are multiple coding belts in the state.

Example:
The given is the state with 3*3 cities and their dominance representation.
For the given example, there are two coding belts. C1 represents Coding Belt 1 and C2 represents Coding Belt 2.
The government wants to find the number of coder dominant cities in the largest coding belt.
The government will give you the credits in the initiative. Can you help the government?

Note: For the given example, there are 4 coder dominant cities in the largest coding belt.
Input Format
The first line of input consists of two space-separated integers, number of rows, R, and number of columns, C.
Next R lines each consist of C space-separated integers.
Constraints
1<= R, C <=10
Output Format
Print the number of coder dominant cities in the largest Coding belt.
Sample TestCase 1
Input
5 51 1 1 0 00 1 1 0 00 0 0 0 11 0 0 1 11 1 0 0 1
Output
5
Explanation
There are three belts in the given 5*5 cities.
Coding Belt 1 (C1): Number of Coder Dominant Cities = 5
Coding Belt 2 (C2): Number of Coder Dominant Cities = 4
Coding Belt 3 (C3): Number of Coder Dominant Cities = 3

In: Computer Science

Write a program in Java Using object Orientation Design to determine the status of Mini Van...

Write a program in Java Using object Orientation Design to determine the status of Mini Van Sliding Doors. A logical circuit receives a different binary code to allow opening different doors. The doors can be opened by a dashboard switch, inside or outside handle. The inside handle will not open the door if the child safety lock is on or the master lock is on. The gear shift must be in the park to open the door.

  1. A method must be written to indicate the gear shift status and return to main.
  2. A method to display which door is open or can be opened.
  3. A method to show the status of all doors
  4. A method to convert the code to decimal and store in the text file (Character based) as a record.

** MUST USE constructors and methods. The methods should be instantiated by an object. Use simple main. The first bit Stream must be entered by users. The program needs to be interactive

Hints & Suggestions

park

door1

door2

dashboardSwitch

inHandle

outHandle

safteyLock

p d1 d2 dw inh outh sLock desc
1 1 1 1 1 1 0 Saftey Lock Off, door 1 & 2 open
1 1 0 1 1 1 0
1 0 1 1 1 1 0
0 0 0 0 0 0 0 Car not parked, no door works
1 0 0 0 0 1 1 Saftey lock on, door only opens from outside

In: Computer Science

1. Implement the union set function using the prototype. 2. Implement the intersection set function using...

1. Implement the union set function using the prototype.

2. Implement the intersection set function using the prototype.

3. Implement the set difference function using the prototype.

4. Implement the subset function using the prototype.

In: Computer Science

For this assignment you will be creating a basic Hotel Reservation System. The program must meet...

For this assignment you will be creating a basic Hotel Reservation System. The program must meet the following guidelines:

  • User can reserve up to 3 rooms at a time
    • Your program will need to loop through to continue to ask needed questions to determine cost.
  • Room rates (room variants):
    • Suite $250
    • 2 Queens $150
    • 1 King $175
    • Ocean view add $50
    • Fridge for Room $25
    • Pets additional $50
  • Sales tax rate will be 5.5%
  • Your program will show out the total for each room reserved after the user has put in the necessary information. Once all rooms are entered the program will print out the grand total.

Make sure you are using Variables, Looping, and decision statements!

In: Computer Science

Research online to find information on e-waste. Describe e-waste and the environmental impact. How do you...

Research online to find information on e-waste. Describe e-waste and the environmental impact. How do you think e-waste will shape the use of technology in the future? Summarize and describe what you found. Was there anything surprising that you discovered in your research? (cite your source)

In: Computer Science

How might you compare and contrast the organization of the healthcare systems of the United States,...

How might you compare and contrast the organization of the healthcare systems of the United States, Germany, and the United Kingdom?

In: Operations Management

Please summarize the phases, objective, and goals for a high-level data management plan. Thank you, for...

Please summarize the phases, objective, and goals for a high-level data management plan. Thank you, for you much needed assistances.

In: Computer Science

assume you take out an 8,500$ car loan that calls for 48 monthly paymemts of 290$...

assume you take out an 8,500$ car loan that calls for 48 monthly paymemts of 290$ each. calculate the annual payment if the loan is repaid in four annual year end installments. need answer in cash not percent

In: Finance

Email Security Grader: comparing the two domains and Clearly discuss the results. Outline any limitations of...

Email Security Grader:

comparing the two domains and Clearly discuss the results. Outline any limitations of the systems

Domain bmo.com coastcapitalsavings.com
MX Connection Test Passed Passed
Reverse DNS Test Passed Passed
DNSBL Verification Test Passed Passed
SPF Server Test Passed Failed
SPF Client Test No Info No Info
Open Relay and Email Format Test Passed Passed
SMTP Plain Text Authentication Test Passed Passed
POP3 Connection Test No Info No Info
IMAP Connection and Authentication Test No Info No Info
Average Security 91% 66%

In: Computer Science

You are the proprietor of a fledging computer graphics company in Shanghai, China. The sophisticated business...

  1. You are the proprietor of a fledging computer graphics company in Shanghai, China. The sophisticated business application software you need for your business normally sells for 2,900 renminbi (around $350) at computer stores in Shanghai and online. But with an income of just little more than $5,000 a year, you cannot afford to buy the original graphics software for your business. An associate has told you she can get you all the software you need, and more, for only $30. Yet, you have financially strapped friends who code software for the global software companies that make the very programs you need.
  1. Do your personal circumstances make it ethical for you to purchase the pirated software?
  2. What would you do if you were told about a new government effort to actively punish users of pirated software?
  3. Does a software company bear any responsibility for subcontracting work to low-wage markets where its finished product is unaffordable for the same coders who worked on it?

In: Operations Management

A carpenter's square has the shape of an L as shown in the figure below. Locate...

A carpenter's square has the shape of an L as shown in the figure below. Locate its center of gravity. (Take

(x, y) = (0, 0)

at the intersection of d1 and d4. Assume

d1 = 20.0 cm,

d2 = 5.00 cm,

d3 = 5.00 cm,

and

d4 = 13.0 cm.

)

In: Physics

Write in Java * Create a new client class called Plants.java * Write code in the...

Write in Java

* Create a new client class called Plants.java

* Write code in the Plants class that solves problems 1,2,3 and 4

* Include the solutions of the different problems in different methods and call them from the main method

* Use the BagInterface.java and ArrayBag.java, but do not add any code

Problem 1: Create a bag plantsCart, which holds the following spring seedlings(represented by String) Rose, Daisy, Cabbage, Cucumber, Carrot, Cucumber, Daffodil, Daisy, Rose, Iris, Rose, Spinach.

Problem 2: Given the bag plantsCart, write statements that remove and display all plants in the bag

Probelm 3: Write statements that remove and count all occurnace of the string Rose in plantsCart. Do not remoe any other strings from the bag. Report the number of time that Rose occured. Print the new content of plantCarts.

Problem 4: Write a code fragment that moves all flowers from plantCart to a new cart (a new bag of Srtring objects) - flowersCart. At the end, report the numbers of flowers in flowersCart.

HINT: You can create a bag called flowers, which contains the strings representing flowers used in this program: Daisy, Iris, Rose, Daffodil and then use it to check each plant from plantsCart, whether it is a flower or not.

************************************************************************************

**BagInterface.java code**

_____________________________________
public interface BagInterface<T> {

/** Gets the current number of entries in this bag.
@return the integer number of entries currently in the bag */
public int getCurrentSize();

/** Sees whether this bag is full.
@return true if the bag is full, or false if not */
public boolean isFull();

/** Sees whether this bag is empty.
@return true if the bag is empty, or false if not */
public boolean isEmpty();

/** 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);

/** Removes one unspecified entry from this bag, if possible.
@return either the removed entry, if the removal
was successful, or null */
public T remove();

/** Removes one occurrence of a given entry from this bag,
if possible.
@param anEntry the entry to be removed
@return true if the removal was successful, or false if not */
public boolean remove(T anEntry);

/** Removes all entries from this bag. */
public void clear();

/** 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 the bag */
public int getFrequencyOf(T anEntry);

/** Tests whether this bag contains a given entry.
@param anEntry the entry to locate
@return true if the bag contains anEntry, or false otherwise */
public boolean contains(T anEntry);

/** Creates an array of all entries that are in this bag.
@return a newly allocated array of all the entries in the bag */
public T[] toArray();
  
/** Overrides the toString method to give a nice display of the items in
   * the bag in this format Bag{Size:# <1> <2> <3> <4> }
* @return a string representation of the contents of the bag */
public String toString();
  
   /** Test whether this bag is equal to a given (as parameter) bag.
   @param aBag the bag to be compare to
@return true if both bags are equal */
   public boolean equals(ArrayBag<T> aBag)
  
} // end BagInterface


*******************************************************************

***ArrayBag.java code *******

______________________________________________

//Start of ArrayBag class


public class ArrayBag<T> implements BagInterface<T> {

private final T[] bag;
private static final int DEFAULT_CAPACITY = 25;
private int numberOfEntries;

/** Creates an empty bag whose initial capacity is 25. */
public ArrayBag() {
this(DEFAULT_CAPACITY);
} // end default constructor

/** Creates an empty bag having a given initial capacity.
@param capacity the integer capacity desired */
public ArrayBag(int capacity) {
numberOfEntries = 0;

// the cast is safe because the new array contains null entries
@SuppressWarnings("unchecked")
T[] tempBag = (T[]) new Object[capacity]; // unchecked cast
bag = tempBag;
} // end constructor


public boolean add(T newEntry) {
boolean result = true;
if (isFull()) {
result = false;
} else { // assertion: result is true here
bag[numberOfEntries] = newEntry;
numberOfEntries++;
} // end if
return result;
} // end add

/** Retrieves all entries that are in this bag.
@return a newly allocated array of all the entries in the bag */
public T[] toArray() {

// the cast is safe because the new array contains null entries
@SuppressWarnings("unchecked")
T[] result = (T[]) new Object[numberOfEntries]; // unchecked cast
for (int index = 0; index < numberOfEntries; index++) {
result[index] = bag[index];
} // end for
return result;
} // end toArray

/** Sees whether this bag is full.
@return true if the bag is full, or false if not */
public boolean isFull() {
return numberOfEntries == bag.length;
} // end isFull

/** Sees whether this bag is empty.
@return true if the bag is empty, or false if not */
public boolean isEmpty() {
return numberOfEntries == 0;
} // end isEmpty

/** Gets the current number of entries in this bag.
@return the integer number of entries currently in the bag */
public int getCurrentSize() {
return numberOfEntries;
} // end getCurrentSize


public int getFrequencyOf(T anEntry) {
int counter = 0;
for (int index = 0; index < numberOfEntries; index++) {
if (anEntry.equals(bag[index])) {
counter++;
} // end if
} // end for
return counter;
} // end getFrequencyOf

/** Tests whether this bag contains a given entry.
@param anEntry the entry to locate
@return true if the bag contains anEntry, or false otherwise */
public boolean contains(T anEntry) {
return getIndexOf(anEntry) > -1;
} // end contains

/** Removes all entries from this bag. */
public void clear() {
while (!isEmpty()) {
remove();
}
} // end clear

/** Removes one unspecified entry from this bag, if possible.
@return either the removed entry, if the removal was successful,
or null otherwise */
public T remove() {
T result = null;

if (numberOfEntries > 0) {
numberOfEntries--;
result = bag[numberOfEntries];
bag[numberOfEntries] = null;
} // end if


return result;
} // end remove

/** Removes one occurrence of a given entry from this bag.
@param anEntry the entry to be removed
@return true if the removal was successful, or false if not */
public boolean remove(T anEntry) {
int index = getIndexOf(anEntry);
T result = removeEntry(index);
return anEntry.equals(result);
} // end remove


private T removeEntry(int givenIndex) {
T result = null;
if (!isEmpty() && (givenIndex >= 0)) {
result = bag[givenIndex]; // entry to remove
numberOfEntries--;
bag[givenIndex] = bag[numberOfEntries]; // replace entry with last entry
bag[numberOfEntries] = null; // remove last entry
} // end if
return result;
} // end removeEntry


private int getIndexOf(T anEntry) {
int where = -1;
boolean found = false;
for (int index = 0; !found && (index < numberOfEntries); index++) {
if (anEntry.equals(bag[index])) {
found = true;
where = index;
} // end if
} // end for
} // end getIndexOf


public String toString() {

String result = "Bag{Size:" + numberOfEntries + " ";
for (int index = 0; index < numberOfEntries; index++) {
result += "<" + bag[index] + "> ";
} // end for

result += "}";
return result;
}

   public boolean equals(ArrayBag<T> aBag) {
         
boolean result = false; // result of comparison of bags
int position; // want position available throughout method

if (numberOfEntries == aBag.getCurrentSize()) {
// Provisionally these are the same
result = true;
for (position = 0; (position < numberOfEntries); position++) {
// Get the frequency of the item in this bag
int countInThisBag = getFrequencyOf(bag[position]);

int countInOtherBag = aBag.getFrequencyOf(bag[position]);

if (countInThisBag != countInOtherBag) {
result = false }
} // end for
}
return result;
} // end equals
} // end ArrayBag

In: Computer Science