Questions
This week we really want to learn about a file I/O in Java. In Java: 1)...

This week we really want to learn about a file I/O in Java.

In Java:

1) Create a plain empty text file named contacts.

2) Populate the text file with a person's name and account number on each line(Joe Doe 123456789). Create 10 accounts.

3) Store that file in the same location as your project

4) Write a program that will find that file and load it into the computers memory.

5) Read each line of the file and print the associated name but NOT the account number (remember the account number is 9 characters fixed)

In: Computer Science

Discuss the difference between deontological ethical theories and consequentialist ethical theories? How would a deontological theorist...

  1. Discuss the difference between deontological ethical theories and consequentialist ethical theories? How would a deontological theorist differ from a consequentialist theorist when considering the moral status of abortion? What would be relevant to each?

In: Operations Management

Write a python program to create a list of integers using random function. Use map function...

Write a python program to create a list of integers using random function. Use map function to process the list on the series: x + x2/2! + x3/3! + ….n and store the mapped elements in another list. Assume the value of n as 10

In: Computer Science

Describe and discuss how a negative externality internalized into a market. Your discussion must include how...

Describe and discuss how a negative externality internalized into a market. Your discussion must include how the optimal level of pollution is determined, the impact on price and quantity.

In: Economics

Cacioppo and Freberg (2013, p. 21-22) revealed that patients with schizophrenia were a population segment subjected...

Cacioppo and Freberg (2013, p. 21-22) revealed that patients with schizophrenia were a population segment subjected to research without restrictions. How do these ethical and moral injustices support the need for regulation?

In: Psychology

​​​​​ Define what an informative speech should encompass? What is the difference between informative speech about...

​​​​​

  1. Define what an informative speech should encompass?
  2. What is the difference between informative speech about events and issues?
  3. Detail what is a persuasive speech?
  4. Explain logos?

In: Nursing

Sphere A of mass 0.600 kg is initially moving to the right at 4.00 m/s. sphere...

Sphere A of mass 0.600 kg is initially moving to the right at 4.00 m/s. sphere B, of mass 1.80 kg is initially to the right of sphere A and moving to the right at 2.00 m/s. After the two sphere collide, sphere is moving at 3.00 m/s in the same direction as before.

(c) Sphere B then has an off-center collision with sphere C,
which has mass 1.20 kg and is initially at rest. After this collision,
sphere B is moving at 19.0° to its initial direction at
What is the velocity (magnitude and direction) of sphere C after
this collision?

(d) What is the impulse (magnitude and direction)
imparted to sphere B by sphere C when they collide?

(e) Is this second collision elastic or inelastic?

(f) What is the velocity (magnitude and direction) of the center of mass of the system of three
spheres (A, B, and C) after the second collision? No external forces
act on any of the spheres in this problem.

In: Physics

Discuss the ethical culture of an organisation of your choice and assess the ways how this...

Discuss the ethical culture of an organisation of your choice and assess the ways how this organisation address and prevent ethical issues and moral distress. Also, explain the potential risks to an organisation of unethical behavior by employees.

In: Operations Management

For this lab you will implement the class Ball which represents a toy ball. Ball should...

For this lab you will implement the class Ball which represents a toy ball. Ball should have a method bounce() whose return type is void, and should have an integer member bounces that counts the number of times the ball has been bounced. Ball should also have a static method named getTotalBounces which counts the total number of times that any Ball object has been bounced. To do this, you will want to include a static integer member totalBounces which counts the total number of bounces. Once implemented the following code in the main of UseBall should output the number 2 (You should create UseBall.java as well, right?): Ball b1 = new Ball(); Ball b2 = new Ball(); b1.bounce(); b2.bounce(); System.out.println(Ball.getTotalBounces()); Next, we will add some functionality to Ball. First, implement a method void reset(int count) which sets bounces to the value provided in count. How does this affect totalBounces? Next, include an integer variable to keep track of the total number of balls which have been created. Should this variable be static or dynamic? Use this variable to implement the static method getAverageBounces() which returns the average of the number of times that any ball has been bounced. Finally, as a challenge, try to implement the static method bounceAll() which bounces each of the balls at once. This will be difficult unless you include one more static integer member in the class - and even then it might be a bit tricky. Give it your best shot, and don't hesitate to ask the lab assistants for help!

In: Computer Science

In Java: 1) Create a new eclipse project. 2) Create a basic SWING window 3) Create...

In Java:

1) Create a new eclipse project.

2) Create a basic SWING window

3) Create a Label Called Name

4) Create a Text Field for entering the name

5) Create a Text Field for entering and email

5) Create a text area to push the results to

6) Create two buttons, one that says submit and the other that says clear.

7) When the user enters their name and email, they should press submit and see the Text area populate with the data they submitted.

8) When the user presses clear it should clear any text from all fields.

In: Computer Science

Translate following C# code into MIPS assembly language int recursive(int x) { return (x >= 0xFF)...

Translate following C# code into MIPS assembly language

int recursive(int x) {
return (x >= 0xFF) ? (recursive(x - 3) + recursive(x - 2))

                : ((x >= 0xF) ? recursive(x - 1) + 1 : 1);

In: Computer Science

As I was on a hike the other day I came across a small child in...

As I was on a hike the other day I came across a small child in the woods. He told me his life story, with special mention of his disabled sister who loves flowers, and asked me for a favor. He wanted a way to organize the flowers that he picks for her each day and perform a few basic tasks with them, along with a few restrictions. It is our goal to help him out! • He can only carry 25 flowers as adding any more causes many of them to become crushed. • All flowers should be able to be displayed • He should be able to add and remove flowers by using their name. • He needs to be able to search for a specific type of flower in his pack in case his sister has a special request. • He needs to be able to sort flowers by their names alphabetically in ascending order (A-Z) • He needs to show how many of each flower he has in his pack. Now, I have started a simple program which will serve as guidance for you, please help me finish it. (Please don’t modify the code that I give you, just add your code where required) Submit 1 file: Assignment1.java import java.util.Scanner; public class Assignment01Driver { public static void main(String[] args){ new Assignment01Driver (); } // This will act as our program switchboard public Assignment01Driver (){ Scanner input = new Scanner(System.in); String[] flowerPack = new String[25]; System.out.println("Welcome to my flower pack interface."); System.out.println("Please select a number from the options below"); System.out.println(""); while(true){ // Give the user a list of their options System.out.println("1: Add an item to the pack."); System.out.println("2: Remove an item from the pack."); System.out.println("3: Sort the contents of the pack."); System.out.println("4: Search for a flower."); System.out.println("5: Display the flowers in the pack."); System.out.println("0: Exit the flower pack interfact."); // Get the user input int userChoice = input.nextInt(); switch(userChoice){ case 1: addFlower(flowerPack); break; case 2: removeFlower(flowerPack); break; case 3: sortFlowers(flowerPack); break; case 4: searchFlowers(flowerPack); break; case 5: displayFlowers(flowerPack); break; case 0: System.out.println("Thank you for using the flower pack interface. See you again soon!"); System.exit(0); } } } private void addFlower(String flowerPack[]) { // TODO: Add a flower that is specified by the user } private void removeFlower(String flowerPack[]) { // TODO: Remove a flower that is specified by the user } private void sortFlowers(String flowerPack[]) { // TODO: Sort the flowers in the pack (No need to display them here) - Use Selection or Insertion sorts // NOTE: Special care is needed when dealing with strings! research the compareTo() method with strings } private void searchFlowers(String flowerPack[]) { // TODO: Search for a user specified flower } private void displayFlowers(String flowerPack[]) { // TODO: Display only the unique flowers along with a count of any duplicates /* * For example it should say * Roses - 7 * Daffodils - 3 * Violets - 5 */ } }

In: Computer Science

This is my Research project in Business Management " What constitutes effective leadership in a changing...

This is my Research project in Business Management " What constitutes effective leadership in a changing business environment?" Please propose an outline for the project

In: Operations Management

Project name: Practical1LastFirst You are being asked to create a program related to tracking players on...

Project name: Practical1LastFirst

You are being asked to create a program related to tracking players on a ringette team. It is important to create as per the requirements document. The details of the RingettePlayer class are provided in the following class diagram.

RingettePlayer

-firstName: String

-lastName: String

-allergies: String

-jerseyNumber: int

-birthYear: int

Constructors

+RingettePlayer()    

+RingettePlayer(String, String)

+RingettePlayer(int)

+RingettePlayer(String, String, String, int)   

+getters/setters for all

+getInformation():void

+display():void

+toString(): String

Default Values for Attributes

When values are not provided for attributes, the following are the values that should be set for the attributes. Note that these are the only attributes that are to be in the class.

  • firstName and lastName default: “Unknown”
  • allergies default: “”
    • The default for allergies is an empty string
  • jerseyNumber and birthYear: 0

Constructor Details

Create four constructors in the RingettePlayer class based on the following requirements.

  • Default no-parameter constructor
    • Create a default no-parameter constructor for the RingettePlayer which sets attributes to their default values.
  • RingettePlayer(String, String)   
    • First and last names passed as parameters and set.
    • the jersey number, birthYear and allergies set to their default values
  • RingettePlayer(int)
    • jerseyNumber passed as a parameter
    • Other attributes are set to their default values
  • RingettePlayer(String, String, String int, int)
    • Values for all attributes are passed in as parameters and used to set object attribute values.

Controller Class Functionality

In the main method create three object based on the following specifications. You can use your own name for the variable name.

  • The first object created should be created using the constructor that accepts two Strings to set the first and last name in the instance (example: “Brielle”, “Jones”). The user does not have to be prompted for these values. They are to be set as hard coded values.
  • The second object created should be created with the default constructor and the setters used to set her first name (“Marley”), last name (“Stephens”), allergies (“Dust”) and jersey number (9). The user does not have to be prompted for these values. They are to be set as hard coded values.
  • The third object should be created using the default constructor. The values for this object are to be obtained from the user by using the getInformation() method. The output below shows an example with user entered data.
    • Note that when the program runs, they would be prompted for the values of this object as the first interaction with the user.

Additional Requirements

  • After creating each of these objects in the main method, have the program display their values to the console.

Ringette Players

Name: Brielle Jones Jersey Number: 0 Allergies: Birth Year: 0

Name: Marley Stephens Jersey Number: 9 Allergies: Dust Birth Year: 0

Name: Sarah Miles Jersey Number: 15 Allergies: Nuts Birth Year: 2009

  • After showing each of the players above have an additional output which shows the allergies only.

Allergies for all players:

Dust Nuts

In: Computer Science

Toyota Corollas are available in eight different colours, and six different models. The Corolla models differ...

Toyota Corollas are available in eight different colours, and six different models. The Corolla models differ mainly in transmission type and feature packages. Additional option packages are available for some models. Toyota Motors Manufacturing Canada produces cars to order, for two national distributors: Toyota Canada, and Toyota USA. All production is based on firm orders from the distributors. Estimate the total number of unique vehicle configurations that are available, and discuss how Toyota’s distributors decide how many of each to order, and how the cars get to the final customer. Also, discuss Toyota’s claim that all cars are already sold when they leave the plant.

In: Operations Management