Write a program which will declare an array for the prices

Assignment Help JAVA Programming
Reference no: EM132104909

Problem

In C++ code must use arrays and file I/O. and functions and please send the output terminal window display as well, Often, data is presented to a program in multiple files, and needs to be stored in multiple arrays. In this lab, we will use a pair of related data files.

File data1.txt contains prices for 6 auto parts. File data2.txt contains the associated names of those parts. The files are related in that the name on line 1 of data2.txt corresponds to the price on line 1 of data1.txt, and similarly for each pair of lines of the files.

File data1.txt contains the prices in dollar amounts, so choose an appropriate variable data type for this data. data2.txt contains the names in string format.

Program

Write a program which will declare an array for the prices, and an array for the names of the parts, open the files, and load data in the arrays.

There are exactly 6 entries in each file, so you can use static arrays to load your data.  Once the data is loaded, print out the names of the most and least expensive parts.

Together  with the names of the most and least expensive parts, you should print the actual prices for these formatted as $dollars.cents, e.g. $20.12. Please be sure the names and the prices are aligned nicely e.g.:

The name of the most expensive part $100.45

The name of the least expensive part $1.99

File data1.txt

12.50
22.50
3500.00
90.00
30.00
30.00

File data2.txt

gasket
spark_plug
engine
spark_plug_harness
wiper_blades
gas_cap

Reference no: EM132104909

Questions Cloud

What is the current price of aa co : It is expected that dividends will grow at 4% indefinitely. Assuming a discount rate of 12%, what is the current price of AA Co.?
What is taggart constant growth : Based on this information, what is Taggart's constant growth rate in dividends
Write a c program to achieve the indeed compression : Your C program needs to compress a text file. The file 'text.txt' contains the text to be compressed and this file contains lower case letters only.
The costs of environmental protection than poor countries : Briefly, according to Shue, why should rich countries bear more of the costs of environmental protection than poor countries?
Write a program which will declare an array for the prices : Write a program which will declare an array for the prices, and an array for the names of the parts, open the files, and load data in the arrays.
Using cooperative strategies : ow can the resource-based view of the firm help us understand why firms develop and use cooperative strategies such as strategic alliances and joint ventures?
Discuss about the problem of the cubs caps : The problem is this: A teacher comes to class with a box and shows the contents of the box to the students.
Constant growth rate in dividends : Taggart's equity cost of capital is 10%, and its dividends are expected to grow at a constant rate. Based on this information, what is Taggart's constant growth
What is the price of sda co : Assuming the dividends will remain constant indefinitely and shareholders face a discount rate of 15%, what is the price of SDA Co. today?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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