1)
use a single dimension array as a frequency counter, exception handling and methods in a Java application that will allow a user to input the miles driven and gallons used for and arbitrary number of trips. Your program will calculate and display the miles per gallon obtained for each trip and print in floating-point results. Test your exception handling by entering a trip while driving a Kia.
The method main should
Prompt the user for the manufacturer name of the car. They should enter a “1” for Honda, “2” for Toyota,”3” for Ford, “4” for a Chevrolet or a “5” for a Kia for each trip.
Declare an array of size 5 as a frequency counter (do this exactly as I have stated because we want to check our exception handling code).
Call a method that will prompt the user to enter the miles driven, gallons used, calculate the miles per gallon, display how many miles per gallon this type of car got on this trip. This method then passes back a “1” to add to the frequency counter for each type of car. If the car is a Honda, add a “1” to arrayname[1], if the car is a Toyota, add a “1” to arrayname[2], etc.
Use exception handling with a try/catch block to catch an ArrayIndexOutOfBoundsException.
Make sure that division by zero will not take place.
Check that user input is a non-negative number and allow only positive numbers to be input. If the user has made an error in their input, prompt them again to enter a valid number. Be descriptive so they know what they did wrong when they typed in their number.
-i already did most of it although it's not pretty bc its first time programming, however i just need help with the arrays
2)
create:
use a multidimensional array as a frequency counter to keep track of an arbitrary number of car sales of each car and print the array of total car sales. Here is the 5X3 array that will be used as a frequency counter for car sales.
Honda Civic Honda Accord Honda Odyssey
Toyota Corolla Toyota Rav4 Toyota Camry
Ford Fiesta Ford F-150 Ford Fusion
Chevy Malibu Chevy Impala Chevy Cruze
Kia Optima Kia Sorrento Kia Soul
For example, if I sell a Toyota Rav4, the program should add 1 to the array element at position [1, 1].
Declare a two-dimensional array to fit the table above. Remember to correct the intentional error in the previous assignment so that you do not encounter an exception.
Prompt the salesman for the manufacturer name and make of the car. With numbers, but you may use Strings if you’d like. Ex: Enter a “1” for Honda, “2” for Toyota,”3” for Ford, “4” for a Chevrolet or a “5” for a Kia. Next, have them enter a number for the model.
Print the values in all of the elements of the array using for loops with a description of the car sales so that I can understand how many cars were sold of each type (without looking at the code).
Check that user input is a non-negative number and allow only positive numbers to be input. If the user has made an error in their input, prompt them again to enter a valid number. Be descriptive so they know what they did wrong when they typed in their number.
String num[][]=new String[a][b]; if (num<0){}else{} just a sample of the [login to view URL] a professional software engineer .i can deliver this in quick [login to view URL] forward to hear from you,thanks
$20 USD in 2 days
5.0 (1 review)
0.6
0.6
13 freelancers are bidding on average $27 USD for this job
Hello, i am expert in java/c/c++ and i can deliver any task in least time and least payments. The code will be well commented
and well formatted for better understanding. I believe in long term relations so first check your work then release the
payments.
Pm me for further details. Thank You!
Hello, i'm software engineer and expert java developer. I am very good in data structure and can do this project for you. Please message me in chat and discus details.
Regards
Usman Shery
Hi
I have 3+ experience in web development.
I did many job like this.
I have strong knowledge of Mysql, Oracle, Database Design
and I have also strong knowledge in languages like Java, JSP, PHP, Javascript, Bootstrap CSS, Ajgular JS, HTML, CSS, JQuery etc .
My name is Muhammad Shahzeb Ali. I am a Software Engineer.
I have:
1. Extensive knowledge of Java, C++, HTML5, CSS, Bootstrap, PHP, SQL(MySql), Javascript, JQuery, Wordpress
- I have built one large PHP+MySQL portal for alumni of university ase.classworks.info.
- I do not like to do simple HTML coding, I prefer to use existing libraries for that
2. Experience building secure dynamic websites and infrastructure
3. Extreme attention to detail
- Before doing any work I sit and described all details, interfaces and methods which are going to be developed. I like to have clear picture before doing the job
4. Ability to thoroughly test and deliver bug-free code
- For the last 3 years all my projects were launched in time and after go live I received only small things that should be corrected. I check every logical part of code before sending it to QA. I proud the quality I supply to clients