Answer:
Sample output:
Enter integer 3232423
true
Enter integer 12131231
false
Explanation:
Above is the output of the program and for the solution check the screenshots attach to understand clearly the program.
Thanks
Answer:
a. cout<<hidden(15,10)<<endl;
output = 5
b. cout << compute(3, 9) << endl;
output=3
c. cout << hidden(30, 20) << " " << compute(10, hidden(30, 20)) << endl;
output = 10
d. x = 2; y = 8; cout << compute(y, x) << endl;
output= 8
Explanation:
solution a:
num1= 15;
num2= 10;
according to condition 1, num1 is not greater than 20. In condition 2, num2 is also not greater than 20.
so,
the solution is
return num1 - num2 = 15 - 10 = 5
So the output for the above function is 5.
solution b:
as in function there are two integer type variables named as one and two. values of variables in given part are:
one = 3
two = 9
secret = one = 3
for (int i= one + 1 = 3+1 = 4; i<=9%2=1; i++ )
9%2 mean find the remainder for 9 dividing by 2 that is 1.
// there 4 is not less than equal to 1 so loop condition will be false and loop will terminate. statement in loop will not be executed.
So the answer will be return from function compute is
return secret ;
secret = 3;
so answer return from the function is 3.
solution c:
As variables in first function are num1 and num2. the values given in part c are:
num1 = 30;
num2= 20;
According to first condition num1=30>20, So,
num1= num2/10
so the solution is
num1 = 20/10 = 2
now
num1=2
now the value return from function Hidden is,
return num1*num2 = 2* 20 = 40
Now use the value return from function hidden in function compute as
compute(10, hidden(30, 20))
as the value return from hidden(30, 20) = 40
so, compute function becomes
compute(10, 40)
Now variable in compute function are named as one and two, so the values are
one= 10;
two = 40;
as
secret = one
so
secret = 10;
for (int i= one + 1 = 10+1 = 11; i<=40%2=0; i++ )
40%2 mean find the remainder for 40 dividing by 2 that is 0.
// there 11 is not less than equal to 0 so loop condition will be false and loop will terminate. statement in loop will not be executed.
So the answer will be return from function compute is
return secret ;
secret = 10;
so answer return from the function is 10.
solution d:
Now variable in compute function are named as one and two, so the values are
one = y = 8
two = x = 2
There
Secret = one = 8;
So
for (int i= one + 1 = 8+1 = 9; i<=2%2=0; i++ )
2%2 mean find the remainder for 2 dividing by 2 that is 0.
// there 9 is not less than equal to 0 so loop condition will be false and loop will terminate. statement in loop will not be executed.
So the answer will be return from function compute is
return secret ;
secret = 8;
so answer return from the function is 8.
the pivot point
the toolbar area
the view editor
the info header
7. You cannot use the manipulator widget to translate, define, rotate, or scale an object. (1 point)
true
false
Answer:
a = int(input("Enter first value between 1 - 10"))
b = int(input("Enter second value between 1 - 10"))
z = a + b
z += 30
print("The value of z = ", z)
Explanation:
The code is written above in python language to perform the given task.
Now, let us explain each statement of code.
Step 1: The first two lines take input from the user prompting the user to enter the values between 1 to 10.
Then the values are type casted to int using int().
The values are stored in variables a and b.
Step 2: Then, the values of a and b are added to get another variable z.
Step 3: The statement 'z += 30' is equivalent to z = z+30
It adds 30 to the variable z and stores it in the same variable z.
Step 4: Finally the value of variable 'z' is printed using print() command.
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
Dark background and dark text
Dark background and light text
Similar background and text​
Answer: Dark background and light text.
Explanation:
Assuming when you mean by "light text", you mean by white text. This should be able to be readable by users visiting the site.
Answer:
Contrasting background and text
Explanation:
When selecting a color scheme for a website, designers often choose complementary colors that keep the visitor on the website.
Your web page should have three main colors: one for the background, one for the text, and one for the headings. The colors you select should complement each other and be on opposite sides of the color wheel.
Also i got it right on my test!