How do I work with objects in lists and can I create multiple objects with different names in a loop?

I need to create Objects of a class called “Tile”. I have 9×9 chess board like grid and want to initiate the whole board at once. The position of a Tile is defined by an x and y-axis and I …

Representation of an array as a polynomial

What this method should do is take an array of doubles and convert them into a polynomial, for example, if the array is given was [2.0, 3.0, -2.0] the method’s output would be 2.0x^2 + 3.0x^1 – 2.0. …

How to check password for number of lowercase letters entered?

I am using the below script to check my passwords for length, number of uppercase letters and number of digits. Is there a way to make it also check for the number of lowercase letters? I tried to …

How do I get the numberOfQuestions variable to reset back to Zero after the loop completes?

/*Class MentalMathProgram Michael 11/18/2020 This program is designed to present the user with randomly generated numbers and it gets progressively harder for every question correct. / import java….

Java method for checking for duplicate values in an array outputs new line for each duplicate value [closed]

I’ve created a method in java that checks (and counts) for duplicate values in an array: private static void checkDuplicates(String[] array) { int arrayLength = array.length; for (…

How do I get the Scanner in java to read a string? [closed]

How would I get my program to quit when the user enters q? Is there something wrong with the scanner? My code import java.util.*; public class Main{ public static void main(String []args){ …

How to Flip the triangle?

How to flip this triangle? So i was making aritmethic sequance triangle. It was upside down. How do I turn it 180 degree? for example: 1=1 1+2=3 1+2+3=6 etc… my code: package javaapplication4; …

Trying to understanding Exit, Loop, Method and If and Else [JAVA]

Hello guys I need help with my code. I am trying to understand how to use the method, loop,if-else statement, and exit code. So I’m writing a simple calculation base on the user choice but right now I …

How do I recursively count up to less than n [closed]

I am struggling with the problem of having applications of loops and arrays. I have a variable “n” which represents the limit of the loop, i.e. if n = 3, the array would look like: arr[1,2,3,…

Skipping To The Next if Statement from Inside a for Loop

I’ve been learning some Java in my spare time and I’m a beginner, so I’m very sorry if I don’t understand some simple concepts. I’ve been trying to make a “Robot” move around an already made …