100% (1)
page:
3 pages/≈825 words
Sources:
0
Style:
APA
Subject:
IT & Computer Science
Type:
Other (Not Listed)
Language:
English (U.S.)
Document:
MS Word
Date:
Total cost:
$ 16.2
Topic:

Pseudocode and Flowcharts

Other (Not Listed) Instructions:

For this assignment, I only need a pseudocode and flow chart. I would appreciate it if you created those for me. I can handle everything else. you did rally good on those 2 areas last assignment

here are the programs:

1. public class Exercise09_01 {

private double width;

private double height;

// No-arg constructor

public Exercise09_01() {

width = 1.0;

height = 1.0;

}

// Constructor with specified width and height

public Exercise09_01(double width, double height) {

this.width = width;

this.height = height;

}

// Method to calculate and return the area of the rectangle

public double getArea() {

return width * height;

}

// Method to calculate and return the perimeter of the rectangle

public double getPerimeter() {

return 2 * (width + height);

}

public static void main(String[] args) {

// Create two Rectangle objects

Exercise09_01 rectangle1 = new Exercise09_01(4.0, 40.0);

Exercise09_01 rectangle2 = new Exercise09_01(3.5, 35.9);



// Display information about the first rectangle

System.out.println("The area of a rectangle with width " + rectangle1.width + " and height " + rectangle1.height + " is " + rectangle1.getArea());

System.out.println("The perimeter of a rectangle is " + rectangle1.getPerimeter());



// Display information about the second rectangle

System.out.println("The area of a rectangle with width " + rectangle2.width + " and height " + rectangle2.height + " is " + rectangle2.getArea());

System.out.println("The perimeter of a rectangle is " + rectangle2.getPerimeter());

}

}



Program 2:



2. import java.util.Scanner;



public class Exercise09_13 {

public static void main(String[] args) {

// Create a Scanner object for user input

Scanner input = new Scanner(System.in);



// Prompt the user to enter the number of rows and columns in the array

System.out.print("Enter the number of rows and columns in the array: ");

int numRows = input.nextInt();

int numCols = input.nextInt();



// Create a two-dimensional array

double[][] array = new double[numRows][numCols];



// Prompt the user to enter the array elements

System.out.println("Enter the array:");

for (int i = 0; i < numRows; i++) {

for (int j = 0; j < numCols; j++) {

array[i][j] = input.nextDouble();

}

}



// Locate the largest element in the array

Location location = locateLargest(array);



// Display the result

System.out.println("The largest element is " + location.maxValue +

", located at (" + location.row + ", " + location.column + ")");

}



public static Location locateLargest(double[][] a) {

if (a.length == 0 || a[0].length == 0) {

return null; // Return null for empty arrays

}



int maxRow = 0;

int maxCol = 0;

double maxValue = a[maxRow][maxCol];



for (int i = 0; i < a.length; i++) {

for (int j = 0; j < a[i].length; j++) {

if (a[i][j] > maxValue) {

maxRow = i;

maxCol = j;

maxValue = a[i][j];

}

}

}



return new Location(maxRow, maxCol, maxValue);

}

}



class Location {

public int row;

public int column;

public double maxValue;



public Location(int row, int column, double maxValue) {

this.row = row;

this.column = column;

this.maxValue = maxValue;

}

}

Other (Not Listed) Sample Content Preview:

Java Programs Understanding Pseudocode, Flowcharts, and the Test Plan

Students name

Course

University

Professor’s name

Date

Program 1 Pseudocode

Class Exercise09_01:

1 Declare variables

width: double

height: double

2 Create a constructor with no arguments

Function Rectangle ():

Initialize the variables in the constructor

width = 1.0

height = 1.0

3 Create a constructor with specified width and height

Function Rectangle (double width, double height):

this. width = width

this. height = height

...
Updated on
Get the Whole Paper!
Not exactly what you need?
Do you need a custom essay? Order right now:

👀 Other Visitors are Viewing These APA Essay Samples:

Sign In
Not register? Register Now!