Question: please write it down on java and not here . Objective: In this lab we are going to practice two tasks together: 1. Using 2D
Objective: In this lab we are going to practice two tasks together: 1. Using 2D array 2- Reading and writing to a text file in Java . Write a java program that solves the following problem using 2-dimensional arrays and I/O to a text file: Suppose we have a bunch of triangles prism and we would like to find the volume of each one: Create two 2D arrays [2][2] that store the base (double) and height (double) Read the base (b) and the height (h) from the user then store them in the arrays Use 3 as altitude (a) for the triangle prism. Calculate the volume of the triangle prism using this formula: AV=0.5bha Store the volume in another 2D array (double) Write the base, height and volume in a text file (triangles prism.txt) Submit your code and your text file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
