Select Page

CSCI 2467 CSCC Java Lab Array for Storing Smartphone Prices Programming Exercise

Question Description

MUST BE DONE IN INTELLIJ

CSCI-2467 Lab 4 – Smartphone Prices

Background

Write and submit the source code for the following program. The program will use an integer array of size 10 to store the prices of smartphones. It will then determine and print the prices of the most expensive and cheapest phones. Use the following variables:

int[] prices = new int[10]; // Array of smartphone prices

Assignment

  • Ask the user for the price of each smartphone (using a for loop)
  • Sort the list of smartphones (once) from low to high price using the following statement:
  • Print the three most expensive phones in order of decreasing price using the sorted array and a for loop
  • Print the three cheapest phones in order of increasing price using the sorted array and another for loop
Arrays.sort(prices);

As always use the package name edu.cscc and include a comment with your name, the date, and the purpose of the program.

Sample Output

Enter all smartphone prices: 1100 1080 900 1200 900 700 550 800 400 250

Three Most Expensive Phones

1200

1100

1080

Three Cheapest Phones

250

400

550

Process finished with exit code 0

"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."

Order Solution Now