Skip to content

SubSkip/JavaDataStructuresPart2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Getting Started

Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.

Folder Structure

The workspace contains two folders by default, where:

  • src: the folder to maintain sources
  • lib: the folder to maintain dependencies

Dependency Management

The JAVA DEPENDENCIES view allows you to manage your dependencies. More details can be found here.

Submit: Java Data Structures Part 2

Data Structures Write a program to sum all the values of a given Array in Java. What is the output? double[ ] exampleArray = {1,5,6,5,4,1};

      double maximum = examplesArray[0];

      int index = 0;

      for (int i = 1; i<exampleArray.length>; i++){

           if (exampleArray[ i ] > maximum) {

                maximum = exampleArray[ i ];

                index = i;

           }

      }

      System.out.println(index);

Write a public static method called "toPower" that takes in as parameters two integers called size and power. The method should return an array of size "size" with each array index raised to the value of "power." So, for example, if we passed in "size = 4" and "power = 2" to the "toPower," the method should return the following result: [0,1,4,9]. Submit to your GitHub and provide a link to you repository

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages