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 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 |
In: Economics
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 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.
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 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:
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
In: Computer Science
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 = 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 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 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 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%
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In: Finance