Convert into pseudo-code for below code
===============================================
class Main
{
public static void main(String args[])
{
Scanner s=new
Scanner(System.in);
ScoresSingleLL score=new
ScoresSingleLL();
while(true)
// take continuous inputs from user till he
enters -1
{
System.out.println("1--->Enter a number\n-1--->exit");
System.out.print("Enter your choice:");
int
choice=s.nextInt();
if(choice!=-1)
{
System.out.print("Enter the score:");
int number=s.nextInt();
System.out.print("Enter the name:");
String name=s.next();
GameEntry entry=new
GameEntry(name,number);
if(number!=-1)
{
if(score.getNumberOfEntries()==10)
// if linkedlist has more than 10 nodes, remove
min score and add new score
{
int
minValue=score.getMinimumValue(); // function to get
minValue
if(minValue<number)
// if min score is greater than given score,
then dont add new node
{
int
minValueIndex=score.getMinimumValueIndex(); // function
to get minValueIndex
score.remove(minValueIndex);
// remove minValueIndex
node
score.add(entry);
// add the new node
}
}
else
{
score.add(entry);
// if
linked list has less than 10 nodes, add the current node
}
}
score.printScore();
// method to print entries in linked lists
score.printHighestToLowest();
}
else
{
break;
}
}
}
}
class ScoresSingleLL
{
SingleLinkedList head=null;
int noOfEntries=0;
public void add(GameEntry e)
{
SingleLinkedList tempNode=new
SingleLinkedList(e);
if(head==null)
// if list is empty add new
node as head
{
head=tempNode;
}
else
{
SingleLinkedList
node=head;
while(node.next!=null) // else add
new node at tail
{
node=node.next;
}
node.next=tempNode;
}
noOfEntries++;
}
public GameEntry remove(int minValueIndex)
{
SingleLinkedList node=head;
if(minValueIndex==0)
// if value to be removed is head, remove
head
{
head=head.next;
}
else
{
SingleLinkedList
prevNode=head; // else remove index
'i' element
node=head.next;
int
index=1;
while(index!=minValueIndex)
{
index++;
prevNode=node;
node=node.next;
}
prevNode.next=node.next;
}
noOfEntries--;
return node.node;
}
public int getMinimumValueIndex()
{
SingleLinkedList
node=head;
int
minValue=Integer.MAX_VALUE;
int index=0,i=0;
while(node!=null)
{
if(node.node.score<minValue)
{
minValue=node.node.score;
index=i;
}
node=node.next;
i++;
}
return index;
}
public int getMinimumValue()
{
SingleLinkedList
node=head;
int
minValue=Integer.MAX_VALUE;
while(node!=null)
{
if(node.node.score<minValue)
{
minValue=node.node.score;
}
node=node.next;
}
return minValue;
}
public void printHighestToLowest()
{
int [] arr=new
int[noOfEntries];
int i=0;
for(SingleLinkedList
node=head;node!=null;node=node.next)
{
arr[i++]=node.node.getScore();
}
Arrays.sort(arr);
System.out.println(Arrays.toString(arr));
}
public int getNumberOfEntries()
{
return noOfEntries;
}
public void printScore()
{
SingleLinkedList
node=head;
while(node!=null)
{
System.out.println(node.node.name+" "+node.node.score);
node=node.next;
}
}
}
class SingleLinkedList
{
GameEntry node;
SingleLinkedList next;
SingleLinkedList(GameEntry node)
{
this.node=node;
}
}
===============================================
In: Computer Science
If the density of the universe great than a critical value, then
|
it might continue expanding forever. |
||
|
it could expand to a fixed size and remain. |
||
|
it might eventually stop expanding and start collapsing. |
||
|
there's probably less dark matter than luminous. |
In: Physics
A 16.4-kg block rests on a horizontal table and is attached to one end of a massless, horizontal spring. By pulling horizontally on the other end of the spring, someone causes the block to accelerate uniformly and reach a speed of 4.50 m/s in 1.55 s. In the process, the spring is stretched by 0.236 m. The block is then pulled at a constant speed of 4.50 m/s, during which time the spring is stretched by only 0.0565 m. Find (a) the spring constant of the spring and (b) the coefficient of kinetic friction between the block and the table.
In: Physics
In: Psychology
discuss what a disclaimer is, when is it is issued, and how it would affect the format of a standard three paragraph audit report.
In: Accounting
Explain why 1 additional net ATP is produced when the beginning substrate is glycogen compared to glucose. In your answer provide the name of the enzyme responsible for this difference.
In: Biology
What is Sales Tax, its salient features and how it works, do a comparative analysis between Sales Tax and Value Added Tax and render your personal opinion as to which system is better between the two for a developing country
In: Economics
E8-10 (Algo) Computing Depreciation under Alternative Methods LO8-3
Strong Metals Inc. purchased a new stamping machine at the beginning of the year at a cost of $1,900,000. The estimated residual value was $100,000. Assume that the estimated useful life was five years and the estimated productive life of the machine was 300,000 units. Actual annual production was as follows:
| Year | Units |
| 1 | 70,000 |
| 2 | 67,000 |
| 3 | 50,000 |
| 4 | 73,000 |
| 5 | 40,000 |
Required:
1. Complete a separate depreciation schedule for each of the alternative methods.
a. Straight-line.
b. Units-of-production.
c. Double-declining-balance.
This is the chart to use for each question. Boxes with a dash in it do not have to be filled.
| Year | Depreciation Expense | Accumulated Depreciation | Net Book Value |
|---|---|---|---|
| At acquisition | - | - | |
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 |
In: Accounting
C++ programming
You are to implement a MyString class which is our own limited implementation of the std:: string
Header file and test (main) file are given in below, code for mystring.cpp.
Here is header file
mystring.h
/* MyString class */
#ifndef MyString_H
#define MyString_H
#include <iostream>
using namespace std;
class MyString {
private:
char* str;
int len;
public:
MyString();
MyString(const char* s);
MyString(MyString& s);
~MyString();
friend ostream& operator <<(ostream& os, MyString& s); // Prints string
MyString& operator=(MyString& s); //Copy assignment
MyString& operator+(MyString& s); // Creates a new string by concantenating input string
};
#endif
Here is main file, the test file
testMyString.cpp
/* Test for MyString class */
#include <iostream>
#include "mystring.h"
using namespace std;
int main()
{
char greeting[] = "Hello World!";
MyString str1(greeting); // Tests constructor
cout << str1 << endl; // Tests << operator. Should print Hello World!
char bye[] = "Goodbye World!";
MyString str2(bye);
cout << str2 << endl; // Should print Goodbye World!
MyString str3{str2}; // Tests copy constructor
cout << str3 << endl; // Should print Hello World!
str3 = str1; // Tests copy assignment operator
cout << str3 << endl; // Should print Goodbye World!
str3 = str1 + str2; // Tests + operator
cout << str3 << endl; // Should print Hello World!Goodbye World!
return 0;
}
In: Computer Science
A charge of -2.75 nC is placed at the origin of an xy-coordinate system, and a charge of 2.05 nC is placed on the y axis at y = 3.60 cm .
A. If a third charge, of 5.00 nC , is now placed at the point x = 2.65 cm , y = 3.60 cm find the x and y components of the total force exerted on this charge by the other two charges.
B. Find the magnitude of this force.
C. Find the direction of this force.
In: Physics
In: Nursing
|
NEW PROJECT ANALYSIS You must evaluate a proposal to buy a new milling machine. The base price is $195,000, and shipping and installation costs would add another $13,000. The machine falls into the MACRS 3-year class, and it would be sold after 3 years for $87,750. The applicable depreciation rates are 33%, 45%, 15%, and 7%. The machine would require a $6,000 increase in net operating working capital (increased inventory less increased accounts payable). There would be no effect on revenues, but pretax labor costs would decline by $50,000 per year. The marginal tax rate is 35%, and the WACC is 10%. Also, the firm spent $5,000 last year investigating the feasibility of using the machine. How should the $5,000 spent last year be handled? A. Last year's expenditure is considered as a sunk cost and does not represent an incremental cash flow. Hence, it should not be included in the analysis. B. The cost of research is an incremental cash flow and should be included in the analysis. C. Only the tax effect of the research expenses should be included in the analysis. D. Last year's expenditure should be treated as a terminal cash flow and dealt with at the end of the project's life. Hence, it should not be included in the initial investment outlay. E. Last year's expenditure is considered as an opportunity cost and does not represent an incremental cash flow. Hence, it should not be included in the analysis. What is the initial investment outlay for the machine for
capital budgeting purposes, that is, what is the Year 0 project
cash flow? Round your answer to the nearest cent. What are the project's annual cash flows during Years 1, 2, and 3? Round your answer to the nearest cent. Do not round your intermediate calculations. Year 1 $ Year 2 $ Year 3 $ Should the machine be purchased? |
In: Finance
1) Two vectors, r and s lie in the x y plane. Their magnitudes are 4.84 and 6.09 units respectively, and their directions are 341o and 65.0o respectively, as measured counterclockwise from the positive x axis. What are the values of vectors (a) r . s and (b) | r × s |?
2) For the following three vectors A B C, what is 3⋅C . (3A × B)
?
A =3.00î + 2.00ĵ - 3.00k̂
B =-4.00î + 3.00ĵ + 3.00k̂
C =6.00î - 7.00ĵ
In: Physics
In: Operations Management
1) 10000 lb/h of a 40.00% NaoH solution is crystallized through a combined evaporator-crystallizer process. The feed enters an evaporator which concentrates it to 50.00% NaOH. The concentrated solution then enters the crystallizer with a built in filter. The crystal product is 95% NaOH crystals with the remaining 5% as adhering mother liquor solution. The mother liquor, containing 45.00% NaOH, is mixed back to the feed before entering the evaporator. Determine the recycle flow rate.
2) Resolve the problem, now considering if the mother liquor is not recycled, but the entire process still generates the same amount of product (crystals) as the original problem. Retain all concentrations given. Determine the amount of feed needed if the recycle stream was removed. Compare the recovery ratio (lb NaOH recovered as crystals/lb NaOH in feed) for the two cases to see the importance of the recycle stream.
In: Other