Questions
What is Open Banking? As it is a new challenge for international banks, how should banks...

What is Open Banking? As it is a new challenge for international banks, how should banks prepare for the new challenge?

In: Finance

What is Open Banking? As it is a new challenge for international banks, how should banks...

What is Open Banking? As it is a new challenge for international banks, how should banks prepare for the new challenge?

In: Finance

What are the distinguishing features of the New Classical Macroeconomics? Discuss two policy implications of the...

What are the distinguishing features of the New Classical Macroeconomics? Discuss two policy implications of the New Classical Macroeconomics.

In: Economics

look this code is a correct but i want modify it to allow the client to...

look this code is a correct but i want modify it to allow the client to have three attempts to login to the server

package hw2;

import java.net.*;
import java.util.Formatter;
import java.util.Random;
import java.util.Scanner;
import java.io.*;

public class Client {
   Socket server;
   int port;
   Formatter toNet = null;
   Scanner fromNet = null;
   Scanner fromUser = new Scanner(System.in);

   public Client() {
       try {
           // login at server at local host port 4000
           server = new Socket("localhost",4000);
           System.out.println("UserName: ");
           String user = fromUser.nextLine();
           System.out.println("Password: ");
           String pass = fromUser.nextLine();
           //to dedecate with the server
           fromNet = new Scanner(server.getInputStream());
           toNet = new Formatter(server.getOutputStream());
           toNet.format("%s\n", user);
           toNet.flush();
           toNet.format("%s\n", pass);
           toNet.flush();
           String response=fromNet.nextLine();
           if(!response.equals("valid") {
               System.out.println("Invalid Login!!");
           }else {
               // if login is successful vote at local host port 4001
               server = new Socket("localhost",4001);//establish new connection
               //establish a strem
               toNet = new Formatter(server.getOutputStream());
               System.out.prinln("Enter your vote 0-9: ");
                   String vote = formUser.nextLine();
                   toNet.format("%s\n", vote);
                   toNet.flush();
           }
              
       } catch (IOException ioe) { }
   }

   public static void main(String[] args) {
           new Client();
   }
}

package hw2;
import java.net.*;
import java.io.*;

public class Server extends Thread{//multiple services each is a thread on different port
   ServerSocket server;
   Socket client;
   int port;
  
  
   public Server(int port) {
       this.port=port;
       server= new ServerSocket (port);
       run();
   }
   public void run() {
       try {
           while(true) {
               server = new ServerSocket(port);
               client = server.accept();
               switch(port) {
               case 4000:
                   new ServiceServer0(client).start();
                   break;
               case 4001:           
                   new ServiceServer1(client).start();
                   break;
               default:
                   System.out.println("Invalid port");
                   System.exit(0);
                  
               }
           }
       }catch(IOException ioe) {}
   }

   public static void main(String[] args) {
       new Server (4000).start();
       new Server(4001).start();
      
   }

}

package hw2;
import java.net.*;
import java.util.Formatter;
import java.util.Scanner;
import java.io.*;

public class ServiceServer0 extends Thread{//login multithreaded service
   Socket client;
   Scanner fromNet = null;
   Formatter toNet = null;
   private String login[][] = { { "user1", "pass1" }, { "user2", "pass2" }, { "user3", "pass3" }, { "user4", "pass4" },
           { "user5", "pass5" }, { "user6", "pass6" }, { "user7", "pass7" }, { "user8", "pass8" },
           { "user9", "pass9" }, };
   public ServiceServer0(Socket client) {
       this.client = client;
   }
   public void run() {
       System.out.println("Login Service: Serving client ...");
       try {
           fromNet = new Scanner(client.getInputStream());
           toNet = new Formatter(client.getOutputStream());
           String user = fromNet.nextLine(); //read the user
           String pass = fromNet.nextLine(); // read the pass
           String respone = " ";
           boolena fount = false;
           for (int i=0; i<long.length; i++) {
               if(login[i][0].equals(user) && login[i][1].equals(pass)) {
                   respone="valid";
                   found = true;
                   break; // to go out from for loop
               }
           }
          
           if(!found)
               response= "Invalid";
              
           toNet.format("%s\n", response);
           toNet.flush();
          
       }catch(IOException ioe) {}  
   }
}

package hw2;
import java.net.*;
import java.util.Formatter;
import java.util.Scanner;
import java.io.*;

public class ServiceServer1 extends Thread{
   Socket client;
   Scanner fromNet = null;
   Formatter toNet = null;
   static int[]votes = new int[10];//one instance to accumulate voting results
   public ServiceServer1(Socket client) {
       this.client = client;
   }
   public void run() {
       System.out.println("Voting Service: Serving client ...");
       try {
           fromNet = new Scanner(client.getInputStream());
           toNet = new Formatter(client.getOutputStream());
           int vote = Integer.parseInt(fromNet.nextLine());
           ++votes[vote];
          
           showVotes();
       }catch(IOException ioe) { }
   }
   void showVotes() {
      
   }
}

package hw2;
import java.net.*;
import java.util.Formatter;
import java.util.Scanner;
import java.io.*;

public class ServiceServer2 extends Thread{//other services in similar manner
   Socket client;
   Scanner fromNet = null;
   Formatter toNet = null;

   public ServiceServer2(Socket client) {
       this.client = client;
   }
   public void run() {
       System.out.println("ServiceServer2: Serving client ...");
       try {
           fromNet = new Scanner(client.getInputStream());
           toNet = new Formatter(client.getOutputStream());

          
       }catch(IOException ioe) {}
      
   }

}

In: Computer Science

We will simulate a dice game in which 2 dice are thrown. If the roll is...

We will simulate a dice game in which 2 dice are thrown.

  • If the roll is 7 or 11, you win.
  • If the roll is 2, 3, or 12, you lose
  • If the roll is any other value, it establishes a point.
    • If with a point established, that point is rolled again before a 7, you win.
    • If, with a point established, a 7 is rolled before the point is rolled again you lose.

Build your algorithm incrementally. First write a program that simulates a roll of two dice, then outputs if it is a simple win (7 or 11), or a simple loss (2 or 3 or 12), or something else.

  1. Here is the algorithm.

//get a random number between 1 and 6, call it d1

//get a second random number between 1 and 6, call it d2.

//get the total & print it so we know what it was

//If the total is 7 or 11 print “Congratulations, you win”

//If the total is 2 or 3 or 12 print “You lose”

//If neither of these print “something else”  

  1. Now fix the part where we wrote “something else”. In this case, we rolled a number which we called total. We need to keep rolling the dice and looking at the new total each time. Output the new total each time so you can check if your program is working correctly. If the new total is the same as the total, we win. If the new total is 7, we lose. And if something else we roll again……

Sample output:

The total is 10
The new total is 8
The new total is 10
You win

Sample output:

The total is 9
The new total is 4
The new total is 8
The new total is 10
The new total is 5
The new total is 7
You lose

Sample output:

The total is 7
Congratulations, you win

Sample output:

The total is 12
You lose

Code language: Java use if-else statement

In: Computer Science

The literature following the Krugman model has been dubbed “new trade theory”, and the literature on...

The literature following the Krugman model has been dubbed “new trade theory”, and the literature on firm heterogeneity following the Melitz model “new new trade theory”. Explain reasons why these names have been used to describe these models, contrasting the features of “classic trade theory” with the newer models.

In: Economics

A company decides to raise $30 million in order to finance a new division within the...

A company decides to raise $30 million in order to finance a new division within the company. They will exclusively use new equity to finance this new division. What will be the likely impact of this decision on the company's WACC? Explain why or why not and use financial leverage, component costs and capital structure in your answer.

In: Finance

Answer these questions at least 200 words. thank you! How well do you feel that the...

Answer these questions at least 200 words. thank you!

How well do you feel that the law deals with new technology?

Are there any issues in the news today that illustrate the issues with new technology and the law?

Explain how Twitter, Facebook, and LinkedIn have resulted in the development of new laws and precedent.

In: Finance

Morning Sky, Inc. (MSI), manufactures and sells computer games. The company has several product lines based...

Morning Sky, Inc. (MSI), manufactures and sells computer games. The company has several product lines based on the age range of the target market. MSI sells both individual games as well as packaged sets. All games are in CD format, and some utilize accessories such as steering wheels, electronic tablets, and hand controls. To date, MSI has developed and manufactured all the CDs itself as well as the accessories and packaging for all of its products.

The gaming market has traditionally been targeted at teenagers and young adults; however, the increasing affordability of computers and the incorporation of computer activities into junior high and elementary school curriculums has led to a significant increase in sales to younger children. MSI has always included games for younger children but now wants to expand its business to capitalize on changes in the industry. The company currently has excess capacity and is investigating several possible ways to improve profitability.

MSI is considering eliminating a product from its ToddleTown Tours collection. This collection is aimed at children one to three years of age and includes “tours” of a hypothetical town. Two products, The Pet Store Parade and The Grocery Getaway, have impressive sales. However, sales for the third CD in the collection, The Post Office Polka, have lagged the others. Several other CDs are planned for this collection, but none is ready for production.

MSI’s information related to the ToddleTown Tours collection follows:

Segmented Income Statement for MSI’s
ToddleTown Tours Product Lines
Pet Store Parade Grocery Getaway Post Office Polka Total
Sales revenue $ 145,000 $ 140,000 $ 38,000 $ 323,000
Variable costs 61,000 57,000 34,000 152,000
Contribution margin $ 84,000 $ 83,000 $ 4,000 $ 171,000
Less: Direct Fixed costs 8,600 8,800 3,600 21,000
Segment margin $ 75,400 $ 74,200 $ 400 $ 150,000
Less: Common fixed costs* 7,250 7,000 1,900 16,150
Net operating income (loss) $ 68,150 $ 67,200 $ (1,500 ) $ 133,850


*Allocated based on total sales revenue.

MSI has determined that elimination of the Post Office Polka (POP) program would not impact sales of the other two items. The remaining fixed overhead currently allocated to the POP product would be redistributed to the remaining two products.

Required:
1.
Calculate the incremental effect on profit if the POP product is eliminated.

2. Should MSI drop the POP product?

3-a. Calculate the incremental effect on profit if the POP product is eliminated. Suppose that $1,200 of the common fixed costs could be avoided if the POP product line were eliminated.

3-b. Should MSI drop the POP product?

MSI’s educational products are currently sold without any supplemental materials. The company is considering the inclusion of instructional materials such as an overhead slide presentation, potential test questions, and classroom bulletin board materials for teachers. A summary of the expected costs and revenues for MSI’s two options follows:

CD Only CD with Instructional Materials
Estimated demand 39,000 units 39,000 units
Estimated sales price $ 35.00 $ 50.00
Estimated cost per unit
Direct materials $ 6.75 $ 9.25
Direct labor 9.00 13.00
Variable manufacturing overhead 9.00 12.25
Fixed manufacturing overhead 9.50 9.50
Unit manufacturing cost $ 34.25 $ 44.00
Additional development cost $ 105,000


Required:
1.
Based on the given data, compute the increase or decrease in profit that would result if instructional materials were added to the CDs.

2. Should MSI add the instructional materials or sell the CDs without them?

3-a. Suppose that the higher price of the CDs with instructional materials is expected to reduce demand to 21,000 units. Complete the table given below based on Requirement 1 and 2 data.

3-b. Should MSI add the instructional materials or sell the CDs without them?

In: Accounting

Kennedy Company is thinking about extending trade credit to new customers. This will increase the annual...

Kennedy Company is thinking about extending trade credit to new customers. This will increase the annual sales by $510,000 if credit is extended to these customers. Of the new accounts receivable related to these sales, 11% will be uncollectible. Additional collection costs will be 8% of sales. Besides, production and selling costs will be 65% of sales. The company is in a 30% tax bracket.

11. What is the amount of additional collection costs? $40,800 $56,100 $331,500 $510,000 None of the above

12. What is the profit on the new sales? $24,480 $57,120 $81,600 $510,000 None of the above

13. What is the percentage return on the new sales? 4.80% 8% 11.20% 16% None of the above

14. What is the amount of the new investment in accounts receivable if the accounts receivable are turned over 3 times a year? $110,500 $170,000 $171,360 $331,500 None of the above

15. What is the return on investment, assuming that the only new investment will be in accounts receivable? 8% 14.40% 33.60% 51.69% None of the above

In: Accounting