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

  Write an interface for a bagadt that implements iterable

Write an interface for a BagADT that implements the Iterable interface. Include javadoc comments that will generate specifications for the BagADT so that someone who wants to implement this interface will know what each method does.

  Reads in up to 1000 non-negative integers

Write a program that reads in up to 1000 non-negative integers and displays distinct numbers (i.e., if a number appears multiple times, it is displayed only once). (Hint: Read each number and store it in an array if it is new. If the number is alread..

  Implement a class called reversewords

Implement a class called ReverseWords that uses a stack to output a set of elements input by the user in reverse order.

  Write servlet code for accepting two numbers from user

Write the servlet code for accepting two numbers from user show addition and multiplication of numbers. If error occurs, then call JSP error page to display suitable error message.

  Summary of the case astrazeneca-unitedhealth

What is the summary of the case "AstraZeneca, UnitedHealth, and Others: IT-Asset Management- Do you know what youv've got?"

  Hasanodddigit that returns whether any digit

d named hasAnOddDigit that returns whether any digit of a positive integer is odd. Your method should return true if the number has at least one odd digit and false if none of its digits are odd. 0, 2, 4, 6, and 8 are even digits, and 1, 3, 5, 7, 9 a..

  Uses a loop to populate a one-dimensional array

Write the following program that creates and uses a loop to populate a one-dimensional array that holds the even numbers between 1 and 12; creates and uses a loop to populate a second one-dimensional array that holds the odd numbers between 1 and 12;..

  Part 1product maintenanceyoull create a series of pages

part 1product maintenanceyoull create a series of pages that allow you to add update or delete a product thats

  Evaluate the rtas resource requirements

Design and implement a set of classes and interfaces and use them to evaluate the RTA's resource requirements.

  To translate infix mathematical expression

Write a program in java to translate infix mathematical expression into postfix expression and a program to evaluate the postfix expression

  The program should ask the user to enter the student'' answer

Your program should store these correct answers in an array. (Store each question's correct answer in an element of a string array.) the program should ask the user to enter the student's answers for each of the 20 questions, which should be stored i..

  Despite public and private health insurance programs

Why is it that despite public and private health insurance programs, some US citizens are without health coverage?

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