Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Introduction To Java Using The ArrayList Class: Learning Objectives: Using the ArrayList class (for more flexible collection of variables). Using The ArrayList Class Write some
Introduction To Java Using The ArrayList Class: Learning Objectives: Using the ArrayList class (for more flexible collection of variables). Using The ArrayList Class Write some Java code that creates an ArrayList to store Strings. Use the add method to add six items (e.g. animals, planets, colors, friends, drinks). Print the total number of elements in your ArrayList. | Use an enhanced for loop to print the elements in your ArrayList one at a time. Remove the item at index position 1. Print the contents of your ArrayList now to confirm that this worked. Replace the item in the fifth position with "Greg". Print the contents of your ArrayList now to confirm that this worked. Add two new elements to your ArrayList (one at the end and one at the start). Print the contents of your ArrayList now to confirm that this worked. Use the clear() method to empty your list. Print the contents of your ArrayList now to confirm that this worked. Ten Dice Rolls In And ArrayList Write some Java code that creates an ArrayList to store ten dice rolls. You should ideally use a four loop to make your code efficient and easy to follow. Is It In My ArrayList? Create an ArrayList of Halloween candy (and add five different candies to your list. Ask this user to enter a candy to search for. Print "Yes I found it" or "No its' not there" Introduction To Java Set One Imperial To Metric Conversion Write some code that converts weight from imperial units (in oz) to metric (ing). The user must enter the number of ounces oz) and your code must convert it to grams (g). Use the following conversion to help you: 1 oz is equal to 29g Please enter the weight (in oz) : 3 That is equal to 87 g. Area Of A Circle Write code that calculates the area of a circle (given the diameter provided by the user). Hint: Ask the user to enter the diameter. Use this to calculate the radius (half the diameter) Use the formula Area = pi * (radius squared) to calculate the area. Display the area of the circle as calculated. Please enter the diameter of the circle: 4 The area of the circle is 12.566368 What's In A Name? Ask the user to enter their name. If a period/full stop was entered at the end of the name, you must remove this. Your code must display the length of the name entered (without period / full stop). You must also count how many vowels and consonants are contained in the name. * Print the total number of vowels and consonants in the name entered. Please enter your name: Greg Your name has 4 characters. It contains 1 vowels and 3 consonants. Rainbow Colors Write some code that randomly display one of the colors of the rainbow (e.g. "indigo") Hint: Create an array that contains the seven colors of the rainbow. Generate a random number and use this to randomly display a color. yellow violet blue Introduction To Java Your E-mail Address Write some code that asks the user to enter their first name and last name. You must combine their last name and the first letter of their first name (without any spaces) and all in lower case with "@btvi.edu.bs" to create and display their e-mail address. Please enter your first name: Greg Sean Please enter your last name: Culmer Your new e-mail address is: Culmer@btvi.edu.bs odd Spinner Statistics A game show uses a spinner that can land on the numbers from 1-8 inclusive. Use a for loop to spin the spinner ten times, and save the results in an array. Display the results of the spinner (sorted from the lowest to the highest). Can you write code that determines how many times an odd number was spun? The results of the spinner are: [1, 2, 2, 3, 4, 4, 6, 7, 7, 8] An odd number was spun 4 times. Squares Write some code that prints the numbers from 1 to 10 (inclusive) and their squares. The square is the value multiplied by itself. You must create a method that returns the squre of the number provided. Hint: Write a for loop that prints the numbers from 1 to 10 inclusive. Use your method to calculate the square and print this too. 1+1 24 379 4 +16 525 636 7749 864 981 10 100
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started