Questions
This is just a very basic program/problem in Java I'm looking for some second opinions on....

This is just a very basic program/problem in Java I'm looking for some second opinions on.

1. Ask the user for a year input (positive integer - should be between 1500 and 2019, inclusive).

2. If the year input is not between 1500 and 2019, do not check for leap year, rather print that this year cannot be checked.

3. Take a year input from the user (should be between 1500 and 2019)

4. If the input year is a leap year, print that year is a leap year; otherwise, print that the year is not a leap year.

In: Computer Science

A small economy produced and consumed only two goods (computers and pies) in Year 1 and...

A small economy produced and consumed only two goods (computers and pies) in Year 1 and Year 2, in the amounts shown in the table below.

[Read the next sentence very carefully.] Year 1 is the base year for all calculation purposes in this question, and we also assume that the official market basket for the CPI is the actual mix of output produced in Year 1.

Computers

Pies

Quantity

Price

Quantity

Price

Year 1

30

$1000

100

$10

Year 2

40

$1100

110

$10

  1. Calculate the nominal GDP for Year 1.
  2. Calculate the real GDP for Year 2.
  3. Calculate the inflation rate from Year 1 to Year 2, based on GDP deflator in two years.
  4. Calculate the cost of the basket for Year 1.
  5. Calculate the CPI for Year 2.
  6. Calculate the inflation rate from Year 1 to Year 2, based on CPI in two year

In: Economics

You have to be the chief Software Engineer, and your mission is to describe functional and...

You have to be the chief Software Engineer, and your mission is to describe functional and non-functional requirements, as good and detailed as possible. When you are missing data, you have to make assumptions (sometimes wild ones). No one can really answer your questions, and you have a presentation to the higher management in 45 min sharp. By then, you have to construct a document, with a very small ( no more than 10 lines) executive description, and no more than two A4 pages (1.25 space, font 12) text. Good luck.

INFORMATION ABOUT THE PROJECT

Our company is seriously considering of bidding for the following project, and we ask you, the lead Software Engineer, to construct a draft document, with the functional and non-functional requirements. The better your document, the better job will do our business development team to construct a proposal.

Project abstract description

The project is about monitoring the two gates of the University, automate the entry of authorized personnel, plus record all car license plates, if they left at night, and also raise alarms if a car is in the parking for more than 5 days. Also the system needs to report cars that are still at the parking, or during any holiday, or when the University is closed officially (e.g., during summer holidays). During those periods, only high-ranking personnel is automatically allowed to enter (e.g., Deans). All others need to be stopped at the gate, and call their supervisor. For that purpose, the following descriptions have been gathered.

Notes

• Each security room next to each gate, will be equipped with the necessary hardware, in order for the guards to see the license plate camera, plus another camera facing the car driver. Also each car will be equipped with electronic id device. The entry bar will be connected to the system, and will be automatically raised, if the car and driver are both authorized.

  • The license plate cameras have to have a good false positive rate. The driver-side camera will not do face recognition at the beginning, but the client wants this to be an option for the near future.

  • The time it takes for one car to enter, is of great importance. The client needs to know this in detail.

  • There should be a “manual override” button on the screen, but the system should keep all details possible, guard details, time, date, car & license picture, etc.

  • The client will accommodate all data into their own facilities and infrastructure, but they will not provide any hardware/software for this project.

  • The guards will be trained accordingly if desired.

  • The data gathered should not be used for other purposes.

  • The staff, students, faculty, are really worried about their personal data, and how those

    are going to be used. Some even claim that the data will be used to monitor their

    working time.

  • Our company, is worried about the cost of this project, and we want to find innovative

    ways to keep the cost low, so we can bid a lower price, and get a competitive advantage

    against other bidders.

  • Our company also is not very experienced in such projects, and they hired you to “make

the difference”.

In: Computer Science

Find a method of ArrayList that is not in the List interface, specifically a method that...

Find a method of ArrayList that is not in the List interface, specifically a method that trims the internal array down to fit exactly. A Google search for this did work, but the JDK API of course is the definitive source.

  1. Give the method header for the method.
  2. Add a call to this method to TestArrayList.java (which is available online in TestArrayList.zip), and see that it compiles and runs fine. Now change the line creating the ArrayList to use type List<String>for its variable (List <String>array = ...), and add the needed import for List. What happens when you try to compile this new version? For the homework answer, give the output.
  3. Explain why the compilation failed in this case. Note that this method is hardly ever used, and shows an example of a technical method related to the implementation that is excluded from the more abstract interface.
  4. Show that you can leave the type of array as List for most of the program (which is good programming practice, since most of it only needs a List) and still call this special method by "downcasting" array to ArrayList just for this one call. We use downcasting when we want to access specific behaviors of a subtype not supported by the original type. In your homework submission, show the line of code with the downcast.

TestArrayList1

import java.util.ArrayList;

public class TestArrayList {

  public static void main( String [ ] args )

  {

     ArrayList<String> array = new ArrayList<String>();

     array.add("apple");

     array.add("banana");

    // Loop through the collection by index

    for ( int i = 0; i < array.size( ); i++ )  {

        System.out.println( array.get( i ) );

    }

    // Using the fact that Collections are Iterable

    for (String s: array) {

        System.out.println(s);

    }

  }

}

TestArrayList2

import java.util.ArrayList;

import java.util.Iterator;

public class TestArrayList2 {

  public static void main( String [ ] args )

  {

     ArrayList<String> array = new ArrayList<String>();

     array.add("apple");

     array.add("banana");

    // Loop through the collection by using an Iterator

     Iterator<String> itr = array.iterator();

     while (itr.hasNext()) {

         System.out.println(itr.next() );

    }

  }

}

TestArrayList3

import java.util.ArrayList;

import java.util.ListIterator;

public class TestArrayList3 {

  public static void main( String [ ] args )

  {

     ArrayList<String> array = new ArrayList<String>();

     array.add("apple");

     array.add("banana");

     // Loop through the collection by using a ListIterator

     ListIterator<String> itr = array.listIterator();

     while (itr.hasNext()) {

         System.out.println(itr.next() );

    }

    // going backwards:

    ListIterator<String> itr2 = array.listIterator(array.size());

     while (itr2.hasPrevious()) {

         System.out.println(itr2.previous() );

    }

    // The listIterator is still alive--

    System.out.println(itr2.next());

  }

}

TestArrayList4

import java.util.ArrayList;

import java.util.ListIterator;

class TestArrayList4

{

    public static void main( String [ ] args )

    {

        ArrayList<Integer> lst = new ArrayList<Integer>( );

        lst.add( 2 );

        lst.add( 4 );      

        ListIterator<Integer> itr1 = lst.listIterator( 0 );

   System.out.print( "Forward: " );

       while( itr1.hasNext( ) )

            System.out.print( itr1.next( ) + " " );

       System.out.println( );             

        System.out.print( "Backward: " );

        while( itr1.hasPrevious( ) )

             System.out.print( itr1.previous( ) + " " );

        System.out.println( );       

        System.out.print( "Backward: " );

        ListIterator<Integer> itr2 =

           lst.listIterator( lst.size( ) );

        while( itr2.hasPrevious( ) )

             System.out.print( itr2.previous( ) + " " );    

        System.out.println( );       

  System.out.print( "Forward: ");

for( Integer x : lst )

System.out.print( x + " " );

System.out.println( );

}

}

In: Computer Science

Comeputer science .This is java problem. PROBLEM 1 Queue (Links to an external site.) is an...

Comeputer science .This is java problem.

PROBLEM 1

Queue (Links to an external site.) is an abstract data type (ADT) consisting of a sequence of entities with a first-in-first-out (FIFO) (Links to an external site.) property. Queue has the following operations, in alignment with the Java Queue interface (Links to an external site.) in the Oracle's SDK:

  • add(x): inserts the specified x element to the back of queue without violating capacity limitation.
  • remove(): removes the head (front) of queue, returning the removed element.
  • peek(): retrieves and displays but does not remove (i.e., read-only) the head of queue.
  • isEmpty: returns whether the queue is empty or not as boolean.

Implement the above FOUR (4) operations in your Solution class as follows. You are responsible for implementing the area shown in red below. Note that you are given TWO (2) local Stacks to help you manage the above listed queue operations.

STARTER CODE

import java.util.Stack;
public class HomeworkAssignment5_1 {    
    public static void main(String[] args) {
       // just like any problems, whatever you need here, etc.
    }
}
class Solution {

   // YOUR STACK TO USE FOR THIS PROBLEM
   private Stack<Integer> pushStack = new Stack<Integer>();
   private Stack<Integer> popStack = new Stack<Integer>();

   /* =====================================
   /* !!! DO NOT MODIFY ABOVE THIS LINE!!!
   /* ====================================

   // YOUR STYLING DOCUMENTATION HERE
   public void add(int x) { 
      // YOUR CODE HERE
   }
   // YOUR STYLING DOCUMENTATION HERE
   public int remove() { 
      // YOUR CODE HERE
   }
   // YOUR STYLING DOCUMENTATION HERE
   public int peek() { 
      // YOUR CODE HERE
   }
   // YOUR STYLING DOCUMENTATION HERE
   public boolean isEmpty() { 
     // YOUR CODE HERE
   }
}

EXAMPLES

// TEST CASE #1
Solution sol = new Solution();
sol.add(8);
sol.add(1);  
sol.peek();     // 8 (if you use System.out.println(), for example)
sol.remove();   // 8
sol.isEmpty();  // false
sol.remove();   // 1
sol.isEmpty();  // true
sol.add(2);     
sol.add(3); 
sol.peek();     // 2

// TEST CASE #2
// etc.

CONSTRAINTS / ASSUMPTIONS

  • You must use Java Stack (Links to an external site.) (java.utils.Stack), both local pushStack and popStack instances, to implement the solution queue for this problem; failure to do so receives 0 logic points.
  • You must use only the standard Stack methods, pop(), push(), peek(), and empty(), for this problem.
  • This problem tests your understanding of how queue works in Java by implementing it from scratch using the Stack ADT you learned.
  • All operations called on the queue are valid. In other words, both remove() and peek() will NOT be called on an empty queue. This means you won't have to create any Exceptions to handle errors.
  • Your solution will be tested against 9-10 test cases; -1 for each failed test.

In: Computer Science

be the chief Software Engineer, and your mission is to describe functional and non-functional requirements, as...

be the chief Software Engineer, and your mission is to describe functional and non-functional requirements, as good and detailed as possible. When you are missing data, you have to make assumptions (sometimes wild ones). No one can really answer your questions, and you have a presentation to the higher management in 45 min sharp. By then, you have to construct a document, with a very small ( no more than 10 lines) executive description, and no more than two A4 pages (1.25 space, font 12) text. Good luck.

INFORMATION ABOUT THE PROJECT

Our company is seriously considering of bidding for the following project, and we ask you, the lead Software Engineer, to construct a draft document, with the functional and non-functional requirements. The better your document, the better job will do our business development team to construct a proposal.

Project abstract description

The project is about monitoring the two gates of the University, automate the entry of authorized personnel, plus record all car license plates, if they left at night, and also raise alarms if a car is in the parking for more than 5 days. Also the system needs to report cars that are still at the parking, or during any holiday, or when the University is closed officially (e.g., during summer holidays). During those periods, only high-ranking personnel is automatically allowed to enter (e.g., Deans). All others need to be stopped at the gate, and call their supervisor. For that purpose, the following descriptions have been gathered.

Notes

• Each security room next to each gate, will be equipped with the necessary hardware, in order for the guards to see the license plate camera, plus another camera facing the car driver. Also each car will be equipped with electronic id device. The entry bar will be connected to the system, and will be automatically raised, if the car and driver are both authorized.

  • The license plate cameras have to have a good false positive rate. The driver-side camera will not do face recognition at the beginning, but the client wants this to be an option for the near future.

  • The time it takes for one car to enter, is of great importance. The client needs to know this in detail.

  • There should be a “manual override” button on the screen, but the system should keep all details possible, guard details, time, date, car & license picture, etc.

  • The client will accommodate all data into their own facilities and infrastructure, but they will not provide any hardware/software for this project.

  • The guards will be trained accordingly if desired.

  • The data gathered should not be used for other purposes.

  • The staff, students, faculty, are really worried about their personal data, and how those

    are going to be used. Some even claim that the data will be used to monitor their

    working time.

  • Our company, is worried about the cost of this project, and we want to find innovative

    ways to keep the cost low, so we can bid a lower price, and get a competitive advantage

    against other bidders.

  • Our company also is not very experienced in such projects, and they hired you to “make

the difference”.

In: Computer Science

ArrayStack: package stacks; public class ArrayStack<E> implements Stack<E> {    public static final int CAPACITY =...

ArrayStack:

package stacks;
public class ArrayStack<E> implements Stack<E>
{
   public static final int CAPACITY = 1000; // Default stack capacity.
   private E[] data; //Generic array for stack storage.
   private int top = -1; //Index to top of stack./*** Constructors ***/
   public ArrayStack()
   {
       this(CAPACITY);
       }
   //Default constructor
   public ArrayStack(int capacity)
   {
       // Constructor that takes intparameter.
       data = (E[]) new Object[capacity];
       }
   /*** Required methods from interface ***/
   public int size()
   {
       return (top + 1);
       }
   public boolean isEmpty()
   {
       return (top == -1);
       }
   public void push(E e) throws IllegalStateException
   {
       if(size() == data.length)
       {
           throw new IllegalStateException("Stack is full!");
           }
       data[++top] = e;
       }
   public E top()
   {
       if(isEmpty())
       {
           return null;
           }
       return data[top];
       }
   public E pop()
   {
       if(isEmpty())
       {
           return null;
           }
       E answer = data[top];
       data[top] = null;
       top--;
return answer; }
}

Recall: In the array based implementation of the stack data type, the stack has a limited capacity due to the fact that the length of the underlying array cannot be changed. In this implementation, when a push operation is called on a full stack then an error is returned and the operation fails. There are certain applications where this is not useful. For example, a stack is often used to implement the \undo" feature of text editors, or the \back" button in a web browser. In these cases, it makes sense to remove the oldest element in the stack to make room for new elements. A similar data structure, called a leaky stack is designed to handle the above type of situation in a dierent manner. A leaky stack is implemented with an array as its underlying storage. When a push operation is performed on a full leaky stack, however, the oldest element in the stack is \leaked" or removed out the bottom to make room for the new element being pushed. In every other case, a leaky stack behaves the same as a normal stack. Write an implementation of the leaky stack data structure. Your class should be generic and implement the following public methods: push, pop, size, and isEmpty. Your class must also contain at least two constructors: one where the user does not specify a capacity and a default capacity of 1000 is used, and one where the user does specify a capacity.

Hint: The following is a skeleton of the class to get started (You will have to fill in the missing implementations of the abstract methods from the Stack interface):

public class LeakyStack implements Stack {

public static final int DEFAULT = 1000;

private E[] stack; private int size = 0;

private int stackTop = -1;

public LeakyStack()

{

this(DEFAULT);

}

public LeakyStack(int c);

public void push(E e);

public E pop();

public boolean isEmpty();

public int size(); }

In: Computer Science

Solve in Excel. Show formulas A) You are considering an investment that will pay you $12,000...

Solve in Excel. Show formulas

A) You are considering an investment that will pay you $12,000 the first year, $13,000 the second year, $17,000 the third year, $19,000 the fourth year, $23,000 the fifth year, and $28,000 the sixth year (all payments are at the end of each year).

What is the maximum you would pay for this investment if your opportunity cost is 12%?

B) You are considering an investment that will pay you $12,000 the first year, $13,000 the second year, $17,000 the third year, $19,000 the fourth year, $23,000 the fifth year, and $28,000 the sixth year.

If you pay $70,000 for such an investment, rate of return would you be earning?

C) How much would you be willing to pay for an investment that will pay you and your heirs $16,000 each year in perpetuity if your opportunity cost is 6%?

In: Finance

7. [The following information applies to the questions displayed below.] Hans runs a sole proprietorship. Hans...

7.

[The following information applies to the questions displayed below.]

Hans runs a sole proprietorship. Hans reported the following net §1231 gains and losses since he began business: (Leave no answer blank. Enter zero if applicable.)

Net §1231

Year

Gains/(Losses)

Year 1

$(73,500)

Year 2

19,250

Year 3

0

Year 4

0

Year 5

13,400

Year 6

0

Year 7 (current year)

54,250

a. What amount, if any, of the year 7 (current year) $54,250 net §1231 gain is treated as ordinary income?

Ordinary income

?

b. Assume that the $54,250 net §1231 gain occurs in year 6 instead of year 7. What amount of the gain would be treated as ordinary income in year 6?

Ordinary income

?

In: Accounting

Conch Republic can manufacture the new smart phones for $300 each in variable costs. Fixed costs...

Conch Republic can manufacture the new smart phones for $300 each in variable costs. Fixed costs for the operation are estimated to run $4.3 million per year. The estimated sales volume is 75,000, 95,000, 125,000, 130,000, and 140,000 per year for the next five years, respectively. The unit price of the new smart phone will be $650. The necessary equipment can be purchased for $61 million and will be depreciated on a seven-year MACRS schedule. It is believed the value of the equipment in five years will be $3.4 million.
Shelley has asked you to prepare a report that answers the following questions.

Please use template below to show answer in excel.

Input:

Year 1 Year 2 Year 3 Year 4 Year 5
Units Sales                 75,000          95,000           125,000        130,000    140,000
Equipment Cost        61,000,000
Salvage value           3,400,000
Units Price                       650
Variable cost (per unit)                       300
Fixed costs (per year)           4,300,000
Tax rate 35%
NWC (% of sales) 15%
Required return 12%
Required Payback Period (years)                             3
MACRS Schedule Year 1 Year 2 Year 3 Year 4 Year 5 Year 6 Year 7 Year 8
3-year 33.33% 44.45% 14.81% 7.41%
5- year 20.00% 32.00% 19.20% 11.52% 11.52% 5.76%
7-year 14.29% 24.49% 17.49% 12.49% 8.93% 8.92% 8.93%

4.46%

Pro Forma Income Statements
Year Year 1 Year 2 Year 3 Year 4 Year 5
Revenues          48,750,000          61,750,000         81,250,000        84,500,000        91,000,000
Variable costs          22,500,000          28,500,000         37,500,000        39,000,000        42,000,000
Fixed costs             4,300,000             4,300,000            4,300,000           4,300,000           4,300,000
Depreciation             8,716,900          14,938,900         10,668,900           7,618,900           5,447,300
EBIT          13,233,100          14,011,100         28,781,100        33,581,100        39,252,700
Taxes (35%)             4,631,585             4,903,885         10,073,385        11,753,385        13,738,445
Net income             8,601,515             9,107,215         18,707,715        21,827,715        25,514,255
OCF       17,318,415       24,046,115      29,376,615     29,446,615     30,961,555
Net Working Capital
Year Year 0 Year 1 Year 2 Year 3 Year 4 Year 5
Initial NWC                              -  
Ending NWC
NWC cash flow
Salvage Value
Market value of salvage
Book value of salvage
Taxes on sale:
Aftertax salvage value:
Project Cash Flows
Year Year 0 Year 1 Year 2 Year 3 Year 4 Year 5
OCF
Change in NWC
Capital spending
Total cash flow
Cumulative cash flow
Question 1 Value Decision
Payback Period
Question 2
NPV
Question 3
IRR
Question 4
Profitability Index
Question 5
Target Sales Price

In: Finance