Implement a program such that it simulates the process

Assignment Help Computer Engineering
Reference no: EM132109271

In this project you implement a program such that it simulates the process of repeated attempts to hit a target with a projectile. The goal is to shoot the projectile within a 1 foot distance from the target, since such a short miss is accepted as a hit. Your program is responsible for the following tasks.

Compute the trajectory data of a projectile (such as the time, the maximum height and the distance as described by the formulas above) for a given launch velocity and a launch angle, in particular for an initial choice of a 45 degree angle

Determine if the target is within the range for the given launch velocity, that is check if at the first attempt the distance is sort to the target with more than 1 foot; if so the process is terminated and then restarted with an increased launch velocity (note that for any velocity the longest range is attained if the launch angle is of 45 degrees)

Compute the error of a shot (error = projectile range - distance to target)

Check if the error is less than 1 foot in absolute value (the absolute error); if so, notify the user about the result and terminate the process

Offer the user four chances to modify the launch angle and try to hit the target

Keep track of the smallest absolute error produced by the subsequent attempts; report the best effort to the user

Analysis and Requirements

Input

Initial input values are

(i) launch velocity (feet/sec)

(ii) distance to the desired target (feet)

(iii) gravitational acceleration (a constant)

Additional input values are the launch angles for the repeated attempts when apply. The angle must always be in the range of 0.0 - 45.0 degrees.

Distance, velocity and launch angle are solicited from the user on JOptionPane input windows.

Output

Output messages are displayed both on JOptionPane windows and on the console. Every time a launch has been executed by the program, a report providing the details of the trajectory must be displayed.

Design

For this project you shall design a single class which contains all the necessary data and operations. A suggested class name is Projectile. You must decide upon the necessary import(s).

The Projectile class contains the main method, which in turn contains all your code, including the variable declarations. The main method is responsible for the following tasks:

opens a welcoming window

declares and assigns a named constant for the gravitational acceleration; the value is 32

declares variables (all double) to store projectile data velocity, distance and angle; all initialized to 0

solicits the input values as explained in the Analysis section, if either of these input is the empty string or null (Cancel button), the message as shown in Figure 11 displayed and the program exits; valid input parsed and saved in the relevant variables

computes all the trajectory and output data and saves those in relevant variables (declare and use the necessary variables as specified in the class description below)

builds up and stores the output message in a single string variable

displays the output windows

numbers in the output are formatted to the nearest hundredth; for this purpose, use the String.format( ) method for JOptionPane output; for the console both String.format( ) and printf( ) are applicable; DecimalFormat class is also permitted as explained in the 5th Edition of Gaddis

utilizes if and/or if-else logic to decide if additional launches are necessary and repeats the operations at most four times as needed (note: heavy code repetition will be necessary to cover all four cases, since using loops is not allowed)

terminates the program when it is due

Reference no: EM132109271

Questions Cloud

Spaghetti and tomato sauce : What price can be settled between these two parties such that both individuals can enjoy more of spaghetti and tomato sauce?
Visualize the impact of the automation : practical laboratory exercises to automate a business process, and to visualize the impact of the automation - Assignment - Parchment Bonanza
Describe the process the algorithm is executing : View the visual presentation of your algorithm in xSortLab; Describe the process the algorithm is executing;Characterize and evaluate the algorithm in terms
Evans argued that under accord and satisfaction : Evans used his credit card to run up a $98.75 bill with the Rosen Department Store. When Rosen tried to collect, Evans wrote a check for $79.00.
Implement a program such that it simulates the process : Implement a program such that it simulates the process of repeated attempts to hit a target with a projectile.
Create a program called producer-consumer : Your program will either use unix socket (-u) or shared memory (-s) depending on user input in the command line argument .
How to calcluate the hmac value : Can you help me with the process (or psuedocode) of how to calcluate the HMAC value?
Briefly describe the actual requirements of the job : Describe the principle characteristics of these individuals or groups, particularly those characteristics that impact on their interaction with you
Explain what is a meant by the term event : Programs written for a graphical user interface have to deal with events. Explain what is a meant by the term "event".

Reviews

Write a Review

Computer Engineering Questions & Answers

  How is a field name qualified how is this used when using a

sql built-in functionsanswer the following questions1. what is the simplest sql retrieval?2. what is the purpose of the

  Discuss security attacks on information systems occur

Security attacks on information systems occur all the time and pertain to every aspect of the attacked system

  Disaster recovery procedure for your home computer

create a one-page document of a personal disaster recovery procedure for your home computer

  Write a single statement that computes the product

Place the results in a register of the appropriate size, remember to consider efficient use of available resources.

  What steps would an rpc consist of in the given case

The usual sequence of steps in an RPC involves trapping to the kernel to have the message sent from the client. What steps would an RPC consist of in that case?

  Give the company''s decision support system

Large organizations often link extensive reporting suites to company's Decision Support Systems, in effect creating 'Business Intelligence' (BI) applications.

  Use the R Studio interface to run the Neural Network method

In this exercise, you will use the R Studio interface to run the Neural Network method. You will run the method with different parameters

  Write the recurrence equation and initial conditions

Write the recurrence equation and initial conditions that expresses the execution time cost for the sift function in the above algorithm.

  Describe how to perform an operation removeall

Describe how to perform an operation removeAll(k), which removes all the entries whose keys equal k in an ordered dictionary implemented.

  Write program which will generate Fibonacci sequence numbers

CS 3280 LAB Assignment. You are to design, write, assemble, and simulate an assembly language program which will generate Fibonacci sequence numbers

  Describe the business process or set of procedures

Throughout this course, you will be working on developing several components of either the computer forensics or incident response report you identified.

  Identify the geopolitics of key nations

Create a 1-page, 4-row by 3-column table in Microsoft® Word that depicts laws for the U.S. and two other key nations in the strategic, tactical.

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