Questions
create a file in java where you can store the first name, last name and the...

create a file in java where you can store the first name, last name and the grade of the student. this will repeats until the answer of the question "are you done?" is.equals (y). then write another program that you can read from this file the student's information .

I have dome most of it but my program stores only 1 student's information. WRITE IN FILE

public static void main(String[] args) {

System.out.println("Enter the file name");

Scanner keyboard=new Scanner(System.in);

String fileName= keyboard.next();

boolean done=false;

String response;

PrintWriter output=null;

try {

output=new PrintWriter(fileName);

}

catch(FileNotFoundException e) {

System.out.println ("error in " + fileName);

System.exit(0);

}

while(!done) {

//for (int i=1;i<=2;i++) {

System.out.println("first name:");

String fname= keyboard.next();

System.out.println("Last name:");

String lname=keyboard.next();

System.out.println("Grade:");

double grade=keyboard.nextDouble();

output.println(fname +" "+ lname+" " +grade);

output.close();

System.out.println("Are you done?");

}

String response1 =keyboard.next();

if (response1.equals("y"))

done=true;

}

}

READ THE FILE.

public class ReaderFile {

public static void main(String[] args) throws Exception {

System.out.println("Enter the file name");

Scanner keyboard=new Scanner(System.in);

String fileName=keyboard.next();

File file= new File(fileName);

Scanner input=null;

try {

input= new Scanner(new File(fileName));

}

catch(Exception e) {

System.out.println("Error reading the file" + fileName);

System.exit(0);

}

while(input.hasNext()) {

String fname=input.next();

String lname=input.next();

double grade=input.nextDouble();

System.out.println(fname+" "+lname+" "+grade);

}

}

}

In: Computer Science

A: Name the three types of claims. Explain the difference between claims. B: Name the four...

A: Name the three types of claims. Explain the difference between claims.

B: Name the four validities used to interrogate claims. If you were to question a study’s four validities, provide a question you might ask related to each validity.

In: Psychology

Question1: Define a class Human that contains: - The data fields "first name" and "last name"...

Question1: Define a class Human that contains: - The data fields "first name" and "last name" - A constructor that sets the first and last name to the instance variables. Create also a no-argument constructor - A getName() method which prints the first and last name Define the class Student which inherits Human and contains: - Private data field "mark" of type integer and a constructor which calls the superclass constructor Define the class Worker which inherits Human and contains: - Private date fields "wage" and "hours worked", and a constructor which calls the superclass constructor - A setWageInfo() method which sets the wage information to the instance variables - A calculateWage() method which calculates a worker’s salary based on wage and hours worked Write a program called HumanTest that instantiates two Human objects (one using the noargument constructor and another using the constructor with parameters). Call the method getName(). Create a Student object which calls the getName() method. Create a Worker object which calls the methods getName(), setWageInfo(), and claculateWage().

In: Computer Science

Case-study: Proposed New Airport Runway for the Axe Stream Heights International Airport Author: Ewan MacFarlane Scenario...

Case-study: Proposed New Airport Runway for the Axe Stream Heights International Airport

Author: Ewan MacFarlane

Scenario (2b): In the past two months, members of the local community protest group, PEEPS, have continued to collect case-reports of illnesses attributed to close residential proximity to the airport. They now claim they have ‘uncovered’ a ‘cluster’ of 13 cases of cancer which they say are caused by exposure to pollutants and/or noise from the airport. Dr McGrimace and Ms Lightbody have reviewed these cases but can’t agree whether or not these cases actually are ‘disease cluster’ and/or if living near the airport is the cause. PEEPS has turned to you for advice.

Questions for discussion:

2b.1 ‘Disease cluster’ investigation

What is a ‘disease cluster’ and how should a suspected ‘disease cluster’ be investigated? Are there established processes for investigating a ‘disease cluster’?

What particular challenges are there for investigating a ‘disease cluster’ which is associated with environmental factors (as opposed to an occupational disease cluster)?

What information would you want to know about the cases?

How could you go about obtaining this information?

2b.2 ‘Disease cluster’ communication

Public communication and stakeholder involvement is particularly important when following-up a ‘disease cluster’ – how would you involve the public and stakeholders in this ‘cluster investigation’?

What principles of risk communication are relevant here and how would you ‘operationalise’ them in a situation like this?

What can be the consequences of poor stakeholder/public communication in a situation like this?What are some real examples of ‘botched’ public/stakeholder communication in past cluster investigations and/or other environmental health crises? What went wrong and why? What was done to remedy the situation and did it work?

In: Nursing

Case-study: Proposed New Airport Runway for the Axe Stream Heights International Airport Author: Ewan MacFarlane Scenario...

Case-study: Proposed New Airport Runway for the Axe Stream Heights International Airport

Author: Ewan MacFarlane

Scenario (2b): In the past two months, members of the local community protest group, PEEPS, have continued to collect case-reports of illnesses attributed to close residential proximity to the airport. They now claim they have ‘uncovered’ a ‘cluster’ of 13 cases of cancer which they say are caused by exposure to pollutants and/or noise from the airport. Dr McGrimace and Ms Lightbody have reviewed these cases but can’t agree whether or not these cases actually are ‘disease cluster’ and/or if living near the airport is the cause. PEEPS has turned to you for advice.

Questions for discussion:

2b.2 ‘Disease cluster’ communication

Q: 1 Public communication and stakeholder involvement is particularly important when following-up a ‘disease cluster’ – how would you involve the public and stakeholders in this ‘cluster investigation’?

Q: 2 What principles of risk communication are relevant here and how would you ‘operationalise’ them in a situation like this?

Q: 3What can be the consequences of poor stakeholder/public communication in a situation like this?What are some real examples of ‘botched’ public/stakeholder communication in past cluster investigations and/or other environmental health crises? What went wrong and why? What was done to remedy the situation and did it work?

In: Nursing

Run the  Python Queue Line Simulator  three times Python Queue Line """ File: pyQueueSim.py Author: JD """ import...

Run the  Python Queue Line Simulator  three times

Python Queue Line

"""

File: pyQueueSim.py

Author: JD

"""

import random

print("Queue as a customer line\n")

queue = []              # Empty que

y = int(0)

# Queue up some customers

for i in range(1,20):

    x = random.randint(1, 20)

    if x >= 2 and x<= 8:

      queue.append(x)      # Add to the front

      

# Simulate cumstomer line processing

while True:

   x = random.randint(1, 20)

   if x >= 2 and x<= 8:

      queue.append(x *2)      # Add to the front

      print("Queued :", x)

   elif x >=9 and x <=14 and len(queue)>0:          

     y = queue.pop(0)

     print ("Removed: ",y)

   elif x == 17 and len(queue)>=10:

      print ("Line closing\n")

      while len(queue)>0:
         y = queue.pop(0)

         print ("Removed: ",y)

      break

Queue as a customer line

Queued : 3

Removed:  8

Queued : 7

Queued : 4

Removed:  7

Removed:  6

Removed:  7

Removed:  2

Removed:  2

Removed:  5

Queued : 4

Removed:  4

Queued : 3

Removed:  7

Removed:  6

Queued : 6

Removed:  14

Queued : 5

Removed:  8

Removed:  8

Removed:  6

Queued : 3

Queued : 5

Removed:  12

Queued : 4

Queued : 3

Queued : 3

Queued : 4

Queued : 4

Queued : 5

Queued : 6

Removed:  10

Removed:  6

Queued : 4

Queued : 5

Removed:  10

Removed:  8

Removed:  6

Removed:  6

Removed:  8

Queued : 4

Queued : 8

Queued : 2

Removed:  8

Queued : 8

Queued : 3

Queued : 8

Queued : 7

Removed:  10

Queued : 6

Removed:  12

Removed:  8

Queued : 8

Queued : 8

Queued : 4

Removed:  10

Queued : 4

Removed:  8

Removed:  16

Queued : 5

Removed:  4

Queued : 2

Queued : 2

Queued : 5

Removed:  16

Queued : 4

Line closing

Removed:  6

Removed:  16

Removed:  14

Removed:  12

Removed:  16

Removed:  16

Removed:  8

Removed:  8

Removed:  10

Removed:  4

Removed:  4

Removed:  10

Removed:  8

Press any key to continue . . .

IN PYTHON THANKS

In: Computer Science

Author code /** * LinkedList class implements a doubly-linked list. */ public class MyLinkedList<AnyType> implements Iterable<AnyType>...

Author code
/**
 * LinkedList class implements a doubly-linked list.
 */
public class MyLinkedList<AnyType> implements Iterable<AnyType>
{
    /**
     * Construct an empty LinkedList.
     */
    public MyLinkedList( )
    {
        doClear( );
    }
    
    private void clear( )
    {
        doClear( );
    }
    
    /**
     * Change the size of this collection to zero.
     */
    public void doClear( )
    {
        beginMarker = new Node<>( null, null, null );
        endMarker = new Node<>( null, beginMarker, null );
        beginMarker.next = endMarker;
        
        theSize = 0;
        modCount++;
    }
    
    /**
     * Returns the number of items in this collection.
     * @return the number of items in this collection.
     */
    public int size( )
    {
        return theSize;
    }
    
    public boolean isEmpty( )
    {
        return size( ) == 0;
    }
    
    /**
     * Adds an item to this collection, at the end.
     * @param x any object.
     * @return true.
     */
    public boolean add( AnyType x )
    {
        add( size( ), x );   
        return true;         
    }
    
    /**
     * Adds an item to this collection, at specified position.
     * Items at or after that position are slid one position higher.
     * @param x any object.
     * @param idx position to add at.
     * @throws IndexOutOfBoundsException if idx is not between 0 and size(), inclusive.
     */
    public void add( int idx, AnyType x )
    {
        addBefore( getNode( idx, 0, size( ) ), x );
    }
    
    /**
     * Adds an item to this collection, at specified position p.
     * Items at or after that position are slid one position higher.
     * @param p Node to add before.
     * @param x any object.
     * @throws IndexOutOfBoundsException if idx is not between 0 and size(), inclusive.
     */    
    private void addBefore( Node<AnyType> p, AnyType x )
    {
        Node<AnyType> newNode = new Node<>( x, p.prev, p );
        newNode.prev.next = newNode;
        p.prev = newNode;         
        theSize++;
        modCount++;
    }   
    
    
    /**
     * Returns the item at position idx.
     * @param idx the index to search in.
     * @throws IndexOutOfBoundsException if index is out of range.
     */
    public AnyType get( int idx )
    {
        return getNode( idx ).data;
    }
        
    /**
     * Changes the item at position idx.
     * @param idx the index to change.
     * @param newVal the new value.
     * @return the old value.
     * @throws IndexOutOfBoundsException if index is out of range.
     */
    public AnyType set( int idx, AnyType newVal )
    {
        Node<AnyType> p = getNode( idx );
        AnyType oldVal = p.data;
        
        p.data = newVal;   
        return oldVal;
    }
    
    /**
     * Gets the Node at position idx, which must range from 0 to size( ) - 1.
     * @param idx index to search at.
     * @return internal node corresponding to idx.
     * @throws IndexOutOfBoundsException if idx is not between 0 and size( ) - 1, inclusive.
     */
    private Node<AnyType> getNode( int idx )
    {
        return getNode( idx, 0, size( ) - 1 );
    }

    /**
     * Gets the Node at position idx, which must range from lower to upper.
     * @param idx index to search at.
     * @param lower lowest valid index.
     * @param upper highest valid index.
     * @return internal node corresponding to idx.
     * @throws IndexOutOfBoundsException if idx is not between lower and upper, inclusive.
     */    
    private Node<AnyType> getNode( int idx, int lower, int upper )
    {
        Node<AnyType> p;
        
        if( idx < lower || idx > upper )
            throw new IndexOutOfBoundsException( "getNode index: " + idx + "; size: " + size( ) );
            
        if( idx < size( ) / 2 )
        {
            p = beginMarker.next;
            for( int i = 0; i < idx; i++ )
                p = p.next;            
        }
        else
        {
            p = endMarker;
            for( int i = size( ); i > idx; i-- )
                p = p.prev;
        } 
        
        return p;
    }
    
    /**
     * Removes an item from this collection.
     * @param idx the index of the object.
     * @return the item was removed from the collection.
     */
    public AnyType remove( int idx )
    {
        return remove( getNode( idx ) );
    }
    
    /**
     * Removes the object contained in Node p.
     * @param p the Node containing the object.
     * @return the item was removed from the collection.
     */
    private AnyType remove( Node<AnyType> p )
    {
        p.next.prev = p.prev;
        p.prev.next = p.next;
        theSize--;
        modCount++;
        
        return p.data;
    }
    
    /**
     * Returns a String representation of this collection.
     */
    public String toString( )
    {
        StringBuilder sb = new StringBuilder( "[ " );

        for( AnyType x : this )
            sb.append( x + " " );
        sb.append( "]" );

        return new String( sb );
    }

    /**
     * Obtains an Iterator object used to traverse the collection.
     * @return an iterator positioned prior to the first element.
     */
    public java.util.Iterator<AnyType> iterator( )
    {
        return new LinkedListIterator( );
    }

    /**
     * This is the implementation of the LinkedListIterator.
     * It maintains a notion of a current position and of
     * course the implicit reference to the MyLinkedList.
     */
    private class LinkedListIterator implements java.util.Iterator<AnyType>
    {
        private Node<AnyType> current = beginMarker.next;
        private int expectedModCount = modCount;
        private boolean okToRemove = false;
        
        public boolean hasNext( )
        {
            return current != endMarker;
        }
        
        public AnyType next( )
        {
            if( modCount != expectedModCount )
                throw new java.util.ConcurrentModificationException( );
            if( !hasNext( ) )
                throw new java.util.NoSuchElementException( ); 
                   
            AnyType nextItem = current.data;
            current = current.next;
            okToRemove = true;
            return nextItem;
        }
        
        public void remove( )
        {
            if( modCount != expectedModCount )
                throw new java.util.ConcurrentModificationException( );
            if( !okToRemove )
                throw new IllegalStateException( );
                
            MyLinkedList.this.remove( current.prev );
            expectedModCount++;
            okToRemove = false;       
        }
    }
    
    /**
     * This is the doubly-linked list node.
     */
    private static class Node<AnyType>
    {
        public Node( AnyType d, Node<AnyType> p, Node<AnyType> n )
        {
            data = d; prev = p; next = n;
        }
        
        public AnyType data;
        public Node<AnyType>   prev;
        public Node<AnyType>   next;
    }
    
    private int theSize;
    private int modCount = 0;
    private Node<AnyType> beginMarker;
    private Node<AnyType> endMarker;
}

class TestLinkedList
{
    public static void main( String [ ] args )
    {
        MyLinkedList<Integer> lst = new MyLinkedList<>( );

        for( int i = 0; i < 10; i++ )
                lst.add( i );
        for( int i = 20; i < 30; i++ )
                lst.add( 0, i );

        lst.remove( 0 );
        lst.remove( lst.size( ) - 1 );

        System.out.println( lst );

        java.util.Iterator<Integer> itr = lst.iterator( );
        while( itr.hasNext( ) )
        {
                itr.next( );
                itr.remove( );
                System.out.println( lst );
        }
    }
}
In this project you will add methods to an existing linked list class.



Description:

Modify the author's "MyLinkedList" class to add the following methods.
Perform checking of the parameters and throw exceptions where appropriate.  
  

10 points each (a-h)

   a.  itemCount
        receives a value and returns a count of the number of times this item
        is found in the list.

   b.  swap
        receives two index positions as parameters and swaps the two nodes 
        (the nodes, not just the values inside) at these positions, provided 
        both positions are within the current size.

   c.  sublist
        receives two indexes and returns an ArrayList of node values from the first
        index to the second index, provided the indexes are valid.

   d.  select
        receives a variable number of indexes, and returns an ArrayList of node values
        corresponding to each index given, provided the indexes are valid.

   e.  reverse
        returns a new MyLinkedList that has the elements in reverse order.

   f.  erase 
        receives an index position and number of elements as parameters, and
        removes elements beginning at the index position for the number of 
        elements specified, provided the index position is within the size
        and together with the number of elements does not exceed the size.

   g.  insertList
        receives a List and an index position as parameters, and copies all of the 
        passed list into the existing list at the position specified by the parameter,
        provided the index position does not exceed the size.

   h.  shift
        receives an integer and shifts the list this many nodes forward or backward,
        for example, if passed 2, the first two nodes move to the tail, or if 
        passed -3, the last three nodes move to the front.  
           
              +2:  abcde -> cdeab       -3:  abcde ->  cdeab
          

20 points
   i.  main
        change the main method to demonstrate each of your methods.
  
   


Submit to eLearning:
 MyLinkedList.java


In: Computer Science

Part II: Case Study Market Research Example: How Coca-Cola Lost Millions with This Mistake Author: Scott...

Part II: Case Study

Market Research Example: How Coca-Cola Lost Millions with This Mistake

Author: Scott Smith, Ph.D.

Source: Qualtrics

In the mid-1980s, the Coca-Cola Company made a decision to introduce a new beverage product (Hartley, 1995, pp. 129–145).

The company had evidence that taste was the single most important cause of Coke’s decline in the market share in the late 1970s and early 1980s.

A new product dubbed “New Coke” was developed that was sweeter than the original-formula Coke.

Almost 200,000 blind product taste tests were conducted in the United States, and more than one-half of the participants favored New Coke over both the original formula and Pepsi.

The new product was introduced and the original formula was withdrawn from the market. This turned out to be a big mistake! Eventually, the company reintroduced the original formula as Coke Classic and tried to market the two products simultaneously.

Ultimately, New Coke was withdrawn from the market.

What went wrong?

Two things stand out.

First, there was a flaw in the market research taste tests that were conducted: They assumed that taste was the deciding factor in consumer purchase behavior.

Consumers were not told that only one product would be marketed. Thus, they were not asked whether they would give up the original formula for New Coke.

Second, no one realized the symbolic value and emotional involvement people had with the original Coke.

The bottom line on this is that relevant variables that would affect the problem solution were not included in the research.

Check out these old school Coke commercials.

Link: https://youtu.be/o4YvmN1hvNA

Link: https://youtu.be/ky45YGUA3co

So, what’s the lesson?

Market research matters.

When done correctly you gain decision making power. If done incorrectly, it could end up costing your company millions.

Questions

1. What are the reasons for New Coke to be withdrawn from the market?

2. What is the emotional involvement people had with the original Coke?

3. How could companies avoid this type of market failure? Please list at list three factors that you would use to predict a new product’s market performance and explain.

In: Operations Management

A) DDL For Company DB Schema, Answer the below questions: Emp (Empno, Ename, Job, Hiredate, Sal,...

A) DDL

For Company DB Schema, Answer the below questions:

Emp (Empno, Ename, Job, Hiredate, Sal, Comm, Deptno)

Dept (Deptno, Dname, loc)

1. Retrieve the data of all employees.

2. Retrieve the data of all Salemanemployees.

3. Retrieve the name and Salary of all employees.

4. Retrieve the name and salary of Salemanemployees.

5. Retrieve the name and salary of all employees with Salary more than 2000.

6. Retrieve the Name and Salary of all employees who work in department no 20.

7. Retrieve the name and Job of all employees with Salary more than 2000 and hiredate after 01-01-1981.

8. Retrieve the Job and Salary of all employees with Name = FORD or MARTIN.

9. Retrieve the Name and Number of all Departments.

10. Retrieve the Employee Name and Department number for all employees.

11. Retrieve the Employee Name and Department name for all employees.

12. Retrieve the Employee Name and who works in Department name = RESEARCH.

13. Retrieve the Employee names who workin one of these Departments: RESEARCHand SALES.

14. Retrieve the Employee name who works in department located in NEW YORK.

please write in computer word not on paper

In: Computer Science

Write a JAVA program that prompts the user to enter a single name. Use a for...

Write a JAVA program that prompts the user to enter a single name. Use a for loop to determine if the name entered by the user contains at least 1 uppercase and 3 lowercase letters. If the name meets this policy, output that the name has been accepted. Otherwise, output that the name is invalid.

In: Computer Science