Write an app that allows user to enter a seven-digit number

Assignment Help JAVA Programming
Reference no: EM13541171

Question 1:

Use a one-dimensional array to solve the following problem: A company pays its salespeople on a commission basis. The salespeople receive $200 per week, plus 9% of their gross sales for that week. For example, a salesperson who grosses $5,000 in sales in a week receives $200 plus 9% of $5,000, a total of $ 650. Write an app (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assuming that each salesperson's salary is truncated to an integer amount): $200-299,

$300-399, $400-499, $500-599, $600-699, $700-799, $800-899, $900-999 and over $999.

Write an application that prompts the user to enter the sales for each employee, then it calculates the salesperson's salary. The process repeats until the user finishes entering all employees' information. When the user is done entering this information, it displays how many of the salespeople earned salaries in each of the above ranges.

Question 2:

Standard telephone keypads contain the digits zero through nine. The numbers two through nine each have three letters associated with them. Many people find it difficult to memorize phone numbers, so they use the correspondence between digits and letters to develop seven-letter words that correspond to their phone numbers. For example, a person whose telephone number is 686-2377 might use the correspondence indicated in Fig. 7.29 to develop the seven-letter word "NUMBERS." Every seven-letter word corresponds to exactly one seven-digit telephone number. A restaurant wishing to increase itstakeout business could surely do so with the number 825-3688 (that is, "TAKEOUT").

482_java.png

Every seven-letter phone number corresponds to many different seven-letter combinations. Unfortunately, most of these represent unrecognizable juxtapositions of letters. It's possible, however, that the owner of a barbershop would be pleased to know that the shop's telephone number, 424-7288, corresponds to "HAIRCUT." A veterinarian with the phone number 738-2273 would be pleased to know that the number corresponds to the letters "PETCARE." An automotive dealership would be pleased to know that the dealership number, 639-2277, corresponds to "NEW-CARS."

Write an app that allows the user to enter a seven-digit number, and displays every possible seven-letter word combination corresponding to that number. Avoid phone numbers with the digits 0 and 1.

Question 3:

A bank wants you to create a console app that will allow bank employees to view the clients' information. The app should prompt the user to enter first name, last name, account number and account balance. It should provide options to allow the bank manager to search through each client's information backward and forward. Create a Customer class to represent the client with first name, last name, account number and account balance. The application should use an array of Customer objects to store customer information. DO NOT use any collection classes such as ArrayList, LinkedList, HashSet etc. You can only use the following statement that assumes the maximum number of customers is 100

Customer [] customerList = new Customer[100];

Question 4:

This assignment is based on the principles of clock consistency and drifts in a distributed system. You have to create a simulation, running on a single machine, of a simple distributed system involving a master object (MO) and four process objects (PO). The MO and each PO will contain a logical clock, a concept rst proposed by Lamport.1 The concept of the logical clocks along with the following technique, which is based on the Berkley Algorithm,2 will attempt to resolve the clock consistency in this system:

1. Each event (send or receive) in the system is associated with a time-stamp, based on logical clocks.

2. Each PO, Pi, will have an associated logical clock, LCi. This logical clock is implemented as a simple counter that is incremented between any successive events executed within that PO. Since a logical clock has a monotonically increasing value, it assigns a unique number to every event. The time stamp of an event is the value of the logical clock for that event. Hence, if an event A occurs before an event B in Pi, then LCi(A) < LCi(B).

3. The MO will also contain a logical clock, that will be incremented periodically and as indicated in the next point.

4. After every t units of logical time (a parameter that can be varied), each PO will send its current local time (i.e., value of its logical clock) to the MO. Once a MO receives such a message from any PO, it will average all ve values (i.e., logical clock values of four POs and its logical clock value) and will consider it to be the correct logical clock value. It will then calculate an o set (either positive or negative) for each PO's logical clock and send it to each PO. It will also adjust its logical clock to that correct clock value.

5. A PO will advance its logical clock when it receives a message from the MO containing an o set. If Pi receives a message from MO with an o set ti (could be positive or negative) then Pi should adjust its clock such that LCi = LCi + ti + 1.

6. A Pi will randomly decide, in addition to sending a message to the MO, if it wants to send a message to one or more other Pj s. Upon receipt of such a message, each Pj will also advance its logical clock if the time stamp associated with the incoming message is greater than the current value of its logical clock, i.e., if Pj , receives a message (event B) from Pi with a time stamp t and LCi(B) t then Pj should advance its logical clock such that LCi(B) = t + 1.

7.  Any Pi, in the system, may exhibit Byzantine or arbitrary failures.

Your task is:

1. Propose the interaction and failure models for this system. Discuss the pros and cons of your design.

2. To simulate this entire environment in Java using threads. Allow the simulation to reach a steady-state, i.e., run the program for a large number of iterations. During each iteration and at the end of the simulation compare the values of the logical clocks of POs with that of the MO. Print out the clock drifts (i.e., di erence between the logical clocks of the MO and each PO) for all POs. Repeat the simulation with di erent probabilities and access their e ects on the clock drifts.

Reference no: EM13541171

Questions Cloud

By using observations of the doppler shift of radiation : By using observations of the Doppler Shift of radiation
Generate a table of conversions from kw to hp : Determine the cost of a 4-year education, assuming that the current cost for 1 year at a state school is $5000 - Generate a table of conversions from kW to hp
Compare and contrast equity theory : Compare and Contrast Equity Theory and Achievement-Power-Affiliation Theory. Explain how effective it would be in promoting employee acceptance of the upcoming changes.
Create unique challenges for criminal justice : Special interest crime issues create unique challenges for criminal justice. However, when these special interests work together to mutually support the deviant activities of each other, the complexities for criminal justice can multiply. Ident..
Write an app that allows user to enter a seven-digit number : Write an application that prompts the user to enter the sales for each employee, then it calculates the salesperson's salary. The process repeats until the user finishes entering all employees' information
American criminal justice system at the beginning : Homeland Security was introduced to the American criminal justice system at the beginning of the 21st century. Discuss the role of Homeland Security in modern day criminal justice and evaluate how it has changed the way the field of criminal j..
What factors contributed to such a reception : What factors contributed to such a reception
Collection payment at a 4 percent rate of return : If a hospital were to receive $4,000 per year in payments at the end of each year for the next 12 years from an uninsured patient who underwent an expensive operation, what would de the current value of these collection payment at a 4 percent ..
Start the discussion by describing the challenges : Start the Discussion by describing the challenges that program planners face when trying to promote the idea of personal responsibility with regard to health behavior while also trying to avoid placing the blame on individuals for their health..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Dijikstra for undirected graph using simple scheme with

dijikstra for undirected graph using simple scheme with array and fibonacci heap and compare the performanceresults

  Write a one-class java program

Write a one-class Java program with at least one method (besides main) to determine if the data in your dataset (i.e., in data.txt) follows Benford's law.

  Objectivesthis is an introductory assignment on java

objectivesthis is an introductory assignment on java synchronization. you will use java threads while learning more

  Write a java program called salesinfominer

Write a Java program called SalesInfoMiner that reads in a file of products, stored in text format. The program must then read in information about past sales transactions and output all the products to a new file, sorted by product description,..

  It should have an if statement

The following are hints given: It should have an if statement. This add method determines what number greater than or less than the other number, than it adds the positive or negative. I think this should be a private method.

  Why is the order of the execution of two processes important

Modify the code so that the senderReceiver process sends then receives repeatedly suspending itself for 3 seconds between each iteration.

  Method that receives an array and returns with no duplicate

Write a program that contrains a method that receives an array and returns a new array with no duplicates.

  Create application uses two-dimensional arrays

Create an application which uses 2-dimensional arrays to keep track of 5 students' grades, with each student having 3 different classes.

  Write java program that writes names to text file

Create an empty text file called myfile.txt. Write a Java program that writes your names to the text file created. If the file does not exist, include an exception handler for that error.

  Create a circle class

create acircle class, which has one field, the radius. the class should contains two constructors: a no-argument constructor that set the radius to zero, and a constructor that takes a parameter to set the radius.

  Implement simple java program to input syllabus grades

To implement simple Java program to input (hypothetical) syllabus grades, computing and displaying both normal Mean and Harmonic Mean.

  Part-2write a program that will perform some of the basic

part-2write a program that will perform some of the basic tasks accomplished by a file integrity checker such as

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd