Answered step by step
Verified Expert Solution
Question
1 Approved Answer
- Create a new Java Project named as before, smith4 or jones4 for example. - Create a package with the very same name as your
- Create a new Java Project named as before, smith4 or jones4 for example. - Create a package with the very same name as your project name. - In this one package, write one Java program for each exercise as required below. - Adhere to naming conventions for variables and classes as in section 2.8. - Choose descriptive variable names and identifiers in all programs. - Start each program with your name and SPC ID\# in a comment. - Add a few more comments in each program to explain what your code is doing. - When all programs are done, locate your project folder in your workspace. - Right-click on the project folder folder (don't open it!) and select "Send to" --> "Compressed (zipped) folder" to make a zip with the same name as your project. - Upload the zip here. Type your collaboration statement into the message area. - Submit your assignment. 1. Write a program that analyzes an object falling for 10 seconds. It should contain main and two additional methods. One of the additional methods should return the distance an object falls in meters when passed the current second as an argument. See the formula needed below. The third method should convert meters to feet and return feet. You can look up the conversion factor needed online. The main method should use one loop to call the other methods and generate a table as shown below. The table should be displayed in formatted columns with decimals as shown. s=1/2gt2 where s= distance in meters g=9.8, and t= time in seconds 2. Write a program that simulates tossing a coin. Prompt the user for how many times to toss the coin. Code a method with no parameters that randomly returns either the String "heads"or the string "tails". Call this method in main as many times as requested and report the results. See Example outputs below. Example Outputs How many times should I toss the coin? 1000 Results of 1000 tosses. Heads: 483, tails: 517
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started