Write the answers so we can answer your question
Answer:
See explaination
Explanation:
The program code
import java.util.ArrayList;
public class Main
{
public static void main(String[] args)
{
ArrayList<AirlineTicket> tickets = new ArrayList<AirlineTicket>();
//This creates a randomized list of passengers
addPassengers(tickets);
for(AirlineTicket elem: tickets)
{
System.out.println(elem);
}
//This creates a TicketOrganizer object
TicketOrganizer ticketOrganizer = new TicketOrganizer(tickets);
//These are the methods of the ticketOrganizer in action
System.out.println("\nPassengers Ordered by Boarding Group:");
ticketOrganizer.printPassengersByBoardingGroup();
System.out.println("\nPassengers in line who can board together:");
ticketOrganizer.canBoardTogether();
}
//Do not touch this method! It is adding random passengers to the AirlineTicket array
public static void addPassengers(ArrayList<AirlineTicket> tickets)
{
String[] seats = {"A","B","C","D","E","F"};
for(int index = 0; index< 15; index++)
{
int random = (int)(Math.random() * 5);
AirlineTicket ticket = new AirlineTicket("Passenger " + (index+1), seats[random], ((int)(Math.random()*5)+1), ((int)(Math.random()*8)+1));
tickets.add(ticket);
}
}
}
class TicketOrganizer
{
private ArrayList<AirlineTicket> tickets ;
//constructor with parameter as an arraylist of AirlineTicket
public TicketOrganizer(ArrayList<AirlineTicket> tickets)
{
this.tickets = tickets;
}
//methhods to return the arraylist of airlines
public ArrayList<AirlineTicket> getTickets()
{ //re-organize the ticket first
ArrayList<AirlineTicket> tickets_organized = new ArrayList<AirlineTicket>();
for(int i=1; i<=5; i++)
{
for(AirlineTicket ticket: tickets)
{
if(ticket.getBoardingGroup() == i)
{
tickets_organized.add(ticket);
}
}
}
return tickets_organized;
}
//print the tickets based on boardingGroup
public void printPassengersByBoardingGroup()
{
int count = 0;
for(int i=1; i<=5; i++)
{
System.out.println("Boarding Group " + i + ":");
for(AirlineTicket ticket : tickets)
{
if(ticket.getBoardingGroup() == i)
{
System.out.println("Passenger " + ticket.getName());
}
}
}
See attachment for sample output
Answer:
Read faster
Explanation:
Technology inspires learners to learn as well. They keep trying to figure time to discover and learn stuff from blogs , videos, applications, and games on their computers. At the very same time, kids will understand and have pleasure, which lets them keep involved with the subject.
Answer:
ITS NOT B I THOUGHT IT WAS BUT DO NOT PUT B I PUT B AND GOT THE QUESTION WRONG
Explanation:
DONT PUT B just trying to help idk the answer but not b
b) onto but not one-to-one
c) neither one-to-one nor onto
Answer:
Let f be a function
a) f(n) = n²
b) f(n) = n/2
c) f(n) = 0
Explanation:
a) f(n) = n²
This function is one-to-one function because the square of two different or distinct natural numbers cannot be equal.
Let a and b are two elements both belong to N i.e. a ∈ N and b ∈ N. Then:
f(a) = f(b) ⇒ a² = b² ⇒ a = b
The function f(n)= n² is not an onto function because not every natural number is a square of a natural number. This means that there is no other natural number that can be squared to result in that natural number. For example 2 is a natural numbers but not a perfect square and also 24 is a natural number but not a perfect square.
b) f(n) = n/2
The above function example is an onto function because every natural number, lets say n is a natural number that belongs to N, is the image of 2n. For example:
f(2n) = [2n/2] = n
The above function is not one-to-one function because there are certain different natural numbers that have the same value or image. For example:
When the value of n=1, then
n/2 = [1/2] = [0.5] = 1
When the value of n=2 then
n/2 = [2/2] = [1] = 1
c) f(n) = 0
The above function is neither one-to-one nor onto. In order to depict that a function is not one-to-one there should be two elements in N having same image and the above example is not one to one because every integer has the same image. The above function example is also not an onto function because every positive integer is not an image of any natural number.
b. Surge suppressor
c. CRT
d. UPS
Answer: A) Battery backup
Explanation:
A battery backup are used to provide the source of power backup to various hardware components and desktop computers. In many cases, the devices are plugged into UPS ( uninterruptible power supply) for backup power and it is also depend upon the size of the UPS.
All the battery backups are located inside so that is why, the devices are heavy in weight. Usually, the battery backup front required additional button for performing various functions.
And the battery backup devices are manufacture by using the varying degree of backup abilities.
Answer:
(1) Carry flag (2) Overflow flag (3) Sign or negative Flag
Explanation:
Solution
(1) The carry flag : It refers to the adding or subtracting. a two registers has a borrow or carry bit
(2) The over flow flag: This flag specify that a sign bit has been modified during subtracting or adding of operations
(3) The sign flag: This is also called a negative sign flag is a single bit status in a register that specify whether the last mathematical operations generated a value to know if the most significant bit was set.