Write some Java code representing a task from real life, and include a loop and/or collection. Example:
for (ClothingItem item : laundry) {
washer.add(item);
}
washer.setFillLevel("max");
washer.setTemperature("warm");
washer.wash();---------------------------------------------------------------------------------------------------------------------------------------
Here is an example of AirConditionr
AC
-----------------------------------------
import java.util.Scanner;
class AC
{
\\default constructer
public void AC()
{}
\\cooling on
public void TurnOnCooling()
{
System.out.println(" Turned On
");
}
\\cooling off
public void TurnOffCooling()
{
System.out.println(" Turned Off
");
}
}
public class TemperatureConverter {
public static void main(String[] args) {
Scanner in = new
Scanner(System.in);
AC a=new AC();
/* Input temperature
*/
System.out.print("Enter
temperature in Celsius: ");
float c =
in.nextFloat();
if (c>23)
{
a.TurnOnCooling();
}
else
{
a.TurnOffCooling();
}
}
}
-------------------------------------------------------------------------------------OUTPUT--------------------------------------------------

Write some Java code representing a task from real life, and include a loop and/or collection....
Java Programming: Task: - Write some Java code that creates a collection (an ArrayList, a TreeSet or a LinkedList), puts some elements into it, creates an iterator, uses it a bit and then (1) changes the collection using one of the four techniques listed (not using the first iterator) and then (2) calls one of the three iterator methods listed. (See instructions below for details) - After writing the code answer the following questions: 1.) What is the result? 2.)...
** Write a Java Code ** 1. Use for and switch statements Write a for loop that counts from 1 to 5, and in the for loop body, use a switch statement to display a letter in the alphabet that corresponds to the number (i.e., 1 is A, 2 is B, etc.).
use java code Write a collection of array utility methods. •Write a method to create a list of duplicate numbers in an array. •Write a method to create a list of duplicate Strings in an array. •Convert to using generics.
Write Java code using a for loop that is equivalent to the following do-while loop: int i = 2 ; do { System.out.println(i + " squared is " + (i * i)) ; i += 2 ; } while (i <= 10) ;
java programe
Write a program that prompts the user to enter in an integer number representing the number of elements in an integer array. Create the array and prompt the user to enter in values for each element using a for loop. When the array is full, display the following: The values in the array on a single line. The array with all of the elements reversed. The values from the array that have even numbered values. The values from...
5. Write Java code for a loop that simultaneously computes both the maximum and minimum of an array.
In Java code Write a complete method name convertFile that accepts a File object representing an input text file and a PrintWriter objects as arguments. The method should read the contents of the input file and change all characters to uppercase and store the results in the output file.
The Exercise Write a Java program that stores and retrieves details about a ``basket'' of items bought in a supermarket. Items should have a code, a name, and a price. Once created, it should be possible to change the price of an item, but not its name or code. 1. Write a class for individual items. Do not forget to include constructors, accessors and mutator methods as required. 2. Create another class to store a list of items (the shopping...
Java Language
Write a complete method calculateCost that accepts two parameters: a char representing package code for photo orders and a char representing a code for extra add- ons. The method returns a double representing the amount of the photo order (base order package order and any add-ons). Compute the amount of the order given the following table of base package codes: $12 $24 $40 $70 Add-on cost for the following codes: $5 n $5 MEN $10 no additional cost
Explain the concept of inheritance in java by providing examples from the real life. You should identify the Superclass and Subclasses in your example