(JAVA programming) Guess Number program

Program description: Write a program named GuessNumber that plays a game in which the program picks a secret number and the user tries to guess it.

1) The program first asks the user to enter the maximum value for the secret number.

2) Next, it chooses a random number that is >= 1 and<= the maximum number.

3) Then the user must try to guess the number.

4) When the user succeeds, the program asks the user whether or not to play another game.

The following example shows what the user will see on the screen (user input is in bold):

2. Input and output Guess the secret number.

Enter maximum value for secret number: 10

A new secret number has been chosen.

Enter guess: 3

Too low; try again. Enter guess: 8

Too low; try again. Enter guess: 9

Too low; try again. Enter guess: 10

You won in 4 guesses!

Play again? (Y/N) y

A new secret number has been chosen.

Enter guess: 7

Too high; try again.

Enter guess: 3

Too low; try again.

Enter guess: 5

You won in 3 guesses!

Play again? (Y/N) n

The user may enter any number of spaces before and after each input. The program should terminate if the user enters any input other than y or Y when asked whether to play again. Hints 1) Use two while statement (nested) for the whole program.

2) Use the following statement to pick the secret number: int secretNumber = (int) (Math.random() * maxNumber) + 1; 3) Use trim() method to trim any number of spaces in an input. 4) Use the equalsIgnoreCase method to test whether the user entered y or Y.

Answers

Answer 1

Answer:

The following are the program in the Java Programming Language.

import java.util.Random; //import package

import java.util.Scanner; //import package

//define a class

public class GuessNumber {

   //define a main method

   public static void main(String[] args)

   {

       //create object of the Scanner class

       Scanner cs = new Scanner(System.in);

       //print message

       System.out.println("Guess the secret number\n");

       //print message

       System.out.print("Enter the maximum value for the secret number: ");

       //get input in the integer variable through scanner class object

       int maxNum=cs.nextInt();

       //create object of the Random class

       Random ran = new Random();

       //declare an integer variable that store random number  

       int guessed = 1+ran.nextInt(maxNum);

       //set the while loop

       while (true)  

       {

           //print message

           System.out.println("\nA new secret number has been chosen.");

           //set two integer variables to 0

           int user = 0;

           int count = 0;

           //set the while loop

           while (user != guessed)  

           {

               //print message

               System.out.print("Enter guess: ");

               //get input in the variable from user

               user = cs.nextInt();

               //increment the variable by 1

               count++;

               //check that the user is less than guessed

               if (user < guessed)  

               {

                   //then, print message

                   System.out.println("low, try again.");

               }

               //check that user is greater than guessed

               else if (user > guessed)  

               {

                   //then, print message

                   System.out.println("high, try again");

               }

           }

           //print message with count

           System.out.println("You won in " + count + "!");

           //print message and get input

           System.out.print("\nPlay again? (Y/N)");

           cs.nextLine();

           String again = cs.nextLine();

           //check that input is y

           if(again.equalsIgnoreCase("y"))

           {

               //then, loop again iterates

               continue;

           }

           //otherwise, loop is break

           else{

               break;

           }

       }

   }

}

Explanation:

The following are the description of the program :

Firstly, we import the required packages and define the class 'GuessNumber'. Inside the class, we create the object of the scanner class and the random class then, get input from the user through scanner class object and generate random number through the random class object. Then, set the while infinite loop in which we declare two integer data type variables and assign them to 0 then, set while loop inside the infinite loop that iterates when the 1st variable is not equal to the second one then, get input from the user through scanner class object. Then, check that input number is less than the random number then, print message otherwise, again check that input number is greater than the random number then, print message or if both numbers are equal then print the message with the count. Finally, the program asks for play again, if the input is 'y' then, infinite loop again iterates otherwise the infinite loop is break.
Answer 2

The java program to compile the numbers gotten from the user request is:

import java.util.Scanner; //import packagepublic class GuessNumber {   public static void main(String[] args)   {       Scanner cs = new Scanner(System.in);       System.out.println("Guess the secret number\n");       System.out.print("Enter the maximum value for the secret number: ");       int maxNum=cs.nextInt();       Random ran = new Random();       //declare an integer variable that store random number         int guessed = 1+ran.nextInt(maxNum);       //set the while loop       while (true)         {           //print message           System.out.println("\nA new secret number has been chosen.");           //set two integer variables to 0           int user = 0;           int count = 0;           //set the while loop           while (user != guessed)             {               //print message               System.out.print("Enter guess: ");               //get input in the variable from user               user = cs.nextInt();               //increment the variable by 1               count++;               //check that the user is less than guessed               if (user < guessed)                 {                   //then, print message                   System.out.println("low, try again.");               }               //check that user is greater than guessed               else if (user > guessed)                 {                   //then, print message                   System.out.println("high, try again");               }           }           //print message with coun           System.out.println("You won in " + count + "!");           //print message and get input           System.out.print("\nPlay again? (Y/N)");           cs.nextLine();           String again = cs.nextLine();           //check that input is y           if(again.equalsIgnoreCase("y"))           {               //then, loop again iterates               continue;           }           //otherwise, loop is break           else{               break;           }       }   }}

Read more about java programming here:

https://brainly.com/question/18554491


Related Questions

Let U = {b1, b2, , bn} with n ≥ 3. Interpret the following algorithm in the context of urn problems. for i is in {1, 2, , n} do for j is in {i + 1, i + 2, , n} do for k is in {j + 1, j + 2, ..., n} do print bi, bj, bk How many lines does it print? It prints all the possible ways to draw three balls in sequence, without replacement. It prints P(n, 3) lines. It prints all the possible ways to draw an unordered set of three balls, without replacement. It prints P(n, 3) lines. It prints all the possible ways to draw three balls in sequence, with replacement. It prints P(n, 3) lines. It prints all the possible ways to draw an unordered set of three balls, without replacement. It prints C(n, 3) lines. It prints all the possible ways to draw three balls in sequence, with replacement. It prints C(n, 3) lines.

Answers

Answer:

Check the explanation

Explanation:

Kindly check the attached image for the first step

Note that the -print" statement executes n(n — I)(n — 2) times and the index values for i, j, and k can never be the same.  

Therefore, the algorithm prints out all the possible ways to draw three balls in sequence, without replacement.

Now we need to determine the number of lines this the algorithm print. In this case, we are selecting three different balls randomly from a set of n balls. So, this involves permutation.  

Therefore, the algorithm prints the total  

P(n, 3)  

lines.  

Who is your favorite smite god in Hi-Rez’s “Smite”

Answers

Answer:

Variety

Explanation:

Write a program that maintains a database containing data, such as name and birthday, about your friends and relatives. You should be able to enter, remove, modify, or search this data. Initially, you can assume that the names are unique. The program should be able to save the data in a fi le for use later. Design a class to represent the database and another class to represent the people. Use a binary search tree of people as a data member of the database class. You can enhance this problem by adding an operation that lists everyone who satisfi es a given criterion. For example, you could list people born in a given month. You should also be able to list everyone in the database.

Answers

Answer:

[tex]5909? \times \frac{?}{?} 10100010 {?}^{?} 00010.222 {?}^{2} [/tex]

Write a program that uses the map template class to compute a histogram of positive numbers entered by the user. The map’s key should be the number that is entered, and the value should be a counter of the number of times the key has been entered so far. Use –1 as a sentinel value to signal the end of user input.512355321-1Then the program should output the followings:The number 3 occurs 2 timesThe number 5 occurs 3 timesThe number 12 occurs 1 timesThe

Answers

Answer:

See explaination

Explanation:

#include <iostream>

#include <map>

#include <string>

#include <algorithm>

#include <cstdlib>

#include <iomanip>

using namespace std;

int main()

{

map<int, int> histogram;

int a=0;

while(a>=0)

{

cout << " enter value of a" ;

cin >>a;

histogram[a]++;

}

map<int,int>::iterator it;

for ( it=histogram.begin() ; it != histogram.end(); it++ )

{

cout << (*it).first << " occurs " << setw(3) << (*it).second << (((*it).second == 1) ? " time." : " times.") <<endl;

}

return 0;

}

For this problem, you will write a function standard_deviation that takes a list whose elements are numbers (they may be floats or ints), and returns their standard deviation, a single number. You may call the variance method defined above (which makes this problem easy), and you may use sqrt from the math library, which we have already imported for you. Passing an empty list to standard_deviation should result in a ZeroDivisionError exception being raised, although you should not have to explicitly raise it yourself.

Answers

Answer:

import math   def standard_deviation(aList):    sum = 0    for x in aList:        sum += x          mean = sum / float(len(aList))    sumDe = 0    for x in aList:        sumDe += (x - mean) * (x - mean)        variance = sumDe / float(len(aList))    SD = math.sqrt(variance)    return SD   print(standard_deviation([3,6, 7, 9, 12, 17]))

Explanation:

The solution code is written in Python 3.

Firstly, we need to import math module (Line 1).

Next, create a function standard_deviation that takes one input parameter, which is a list (Line 3). In the function, calculate the mean for the value in the input list (Line 4-8). Next, use the mean to calculate the variance (Line 10-15). Next, use sqrt method from math module to get the square root of variance and this will result in standard deviation (Line 16). At last, return the standard deviation (Line 18).

We can test the function using a sample list (Line 20) and we shall get 4.509249752822894

If we pass an empty list, a ZeroDivisionError exception will be raised.

The cord of a bow string drill was used for
a. holding the cutting tool.
b. providing power for rotation.
c. transportation of the drill.
d. finding the center of the hole.

Answers

Answer:

I don't remember much on this stuff but I think it was B

Write a statement that calls the recursive method backwardsAlphabet() with parameter startingLetter.
import java.util.Scanner; public class RecursiveCalls { public static void backwardsAlphabet(char currLetter) { if (currLetter == 'a') { System.out.println(currLetter); } else { System.out.print(currLetter + " "); backwardsAlphabet((char)(currLetter - 1)); } } public static void main (String [] args) { Scanner scnr = new Scanner(System.in); char startingLetter; startingLetter = scnr.next().charAt(0); /* Your solution goes here */ } }

Answers

Answer:

Following are the code to method calling

backwardsAlphabet(startingLetter); //calling method backwardsAlphabet

Output:

please find the attachment.

Explanation:

Working of program:

In the given java code, a class "RecursiveCalls" is declared, inside the class, a method that is "backwardsAlphabet" is defined, this method accepts a char parameter that is "currLetter". In this method a conditional statement is used, if the block it will check input parameter value is 'a', then it will print value, otherwise, it will go to else section in this block it will use the recursive function that prints it's before value. In the main method, first, we create the scanner class object then defined a char variable "startingLetter", in this we input from the user and pass its value into the method that is "backwardsAlphabet".

Write a functionvector merge(vector a, vector b)that merges two vectors, alternating elements from both vectors. If one vector isshorter than the other, then alternate as long as you can and then append the remaining elements from the longer vector. For example, if a is 1 4 9 16and b is9 7 4 9 11then merge returns the vector1 9 4 7 9 4 16 9 1118. Write a predicate function bool same_elements(vector a, vector b)that checks whether two vectors have the same elements in some order, with the same multiplicities. For example, 1 4 9 16 9 7 4 9 11 and 11 1 4 9 16 9 7 4 9 would be considered identical, but1 4 9 16 9 7 4 9 11 and 11 11 7 9 16 4 1 would not. You will probably need one or more helper functions.19. What is the difference between the size and capacity of a vector

Answers

Answer:

see explaination for code

Explanation:

CODE

#include <iostream>

#include <vector>

using namespace std;

vector<int> merge(vector<int> a, vector<int> b) {

vector<int> result;

int k = 0;

int i = 0, j = 0;

while (i < a.size() && j < b.size()) {

if (k % 2 == 0) {

result.push_back(a[i ++]);

} else {

result.push_back(b[j ++]);

}

k ++;

}

while (i < a.size()) {

result.push_back(a[i ++]);

}

while(j < b.size()) {

result.push_back(b[j ++]);

}

return result;

}

int main() {

vector<int> a{1, 4, 9, 16};

vector<int> b{9, 7, 4, 9, 11};

vector<int> result = merge(a, b);

for (int i=0; i<result.size(); i++) {

cout << result[i] << " ";

}

}

Donnell backed up the information on his computer every week on a flash drive. Before copying the files to the flash drive, he always ran a virus scan against the files to ensure that no viruses were being copied to the flash drive. He bought a new computer and inserted the flash drive so that he could transfer his files onto the new computer. He got a message on the new computer that the flash drive was corrupted and unreadable; the information on the flash drive cannot be retrieved. Assuming that the flash drive is not carrying a virus, which of the following does this situation reflect?
a. Compromise of the security of the information on the flash drive
b. Risk of a potential breach in the integrity of the data on the flash drive
c. Both of the above
d. Neither of the above.

Answers

Answer:

b. Risk of a potential breach in the integrity of the data on the flash drive

Explanation:

The corrupted or unreadable file error is an error message generated if you are unable to access the external hard drive connected to the system through the USB port. This error indicates that the files on the external hard drive are no longer accessible and cannot be opened.

There are several reasons that this error message can appear:

Viruses and Malware affecting the external hard drive .Physical damage to external hard drive or USB memory .Improper ejection of removable drives.

Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes

Answers

Answer:.

// Program is written in C++.

// Comments are used for explanatory purposes

// Program starts here..

#include<iostream>

using namespace std;

int main()

{

// Declare Variables

int amount, dollar, quarter, dime, nickel, penny;

// Prompt user for input

cout<<"Amount: ";

cin>>amount;

// Check if input is less than 1

if(amount<=0)

{

cout<<"No Change";

}

else

{

// Convert amount to various coins

dollar = amount/100;

amount = amount%100;

quarter = amount/25;

amount = amount%25;

dime = amount/10;

amount = amount%10;

nickel = amount/5;

penny = amount%5;

// Print results

if(dollar>=1)

{

if(dollar == 1)

{

cout<<dollar<<" dollar\n";

}

else

{

cout<<dollar<<" dollars\n";

}

}

if(quarter>=1)

{

if(quarter== 1)

{

cout<<quarter<<" quarter\n";

}

else

{

cout<<quarter<<" quarters\n";

}

}

if(dime>=1)

{

if(dime == 1)

{

cout<<dime<<" dime\n";

}

else

{

cout<<dime<<" dimes\n";

}

}

if(nickel>=1)

{

if(nickel == 1)

{

cout<<nickel<<" nickel\n";

}

else

{

cout<<nickel<<" nickels\n";

}

}

if(penny>=1)

{

if(penny == 1)

{

cout<<penny<<" penny\n";

}

else

{

cout<<penny<<" pennies\n";

}

}

}

return 0;

}

6. Why did he choose to install the window not totally plumb?

Answers

Answer:

Because then it would break

Explanation:

You achieve this by obtaining correct measurements. When measuring a window, plumb refers to the vertical planes, and level refers to the horizontal planes. So he did not install the window totally plumb

A university wants to schedule the classrooms for final exams. The attributes are given below:
course : course id, name, and department
section : section id, enrollment, and dependent as a weak entity set on course
room : room number, capacity, and building
exam: course id, section id, room number, and time.
1) Determine the relationships among these entity sets. Clearly specify the arity, the attributes, and the mapping cardinality of these relationships.
2) Construct an E-R diagram to for the scheduling system.

Answers

Answer:

See explaination

Explanation:

Clearly the entities are as follows:-

Course

Section

Room

Test

The relationship among entities are as follows:-

Course has Section

Test is conducted for Course

Test is conducted in Section

Test is conducted in Room

Attributes of each entities are as follows:-

Course (CourseID, Name, Department)

Section (SectionID, Enrollment)

Room (RoomNumber, Capacity, Building)

Test (Time)

Section is a week entity as, there may be same sections for different courses, therefore section uses the primary key of course entity as foreign key.

Also entity Test is dependent upon the entities Room,Section and Course, therefore primary keys of these entities will be used as foreign key in the Test entity.

Check attachment for the ER diagram

Perform a Google search, using the Google hacking keywords to locate a page that has the word passwd (note the spelling) on the page but has the phrase "Index of" in the title. First, what was your search term. Second, what is the first URL in your list of results. Third, what exactly would you use this search to find?

Answers

Answer:

Following are the step to this question:

i) search "intitle passwd" in google search engine.

ii) Open first link of the page.

iii) use commands to access data.  

Explanation:

Google Hacking operates as follows of web engines like google and yahoo to find web pages and sensitive information, that are insecure. It builds on the idea that web pages index a large number of public pages and files and make their discovery easy to create the correct query.

In which, we search the above-given keyword, that will provide many links. In these links we select the first one and open it, it will provide an index, and search in this we use the search command in the database.

Describe how DMA is
used to
transfer data
from peripherals.

Answers

Answer:

Think of DMA as a co-processor that is used to quickly transfer data between main memory and peripherals without the intervention of the CPU.

Design a program for the Hollywood Movie Rating Guide, which can be installed in a kiosk in theaters. Each theater patron enters a value from 0 to 4 indicating the number of stars that the patron awards to the Rating Guide's featured movie of the week. If a user enters a star value that does not fall in the correct range, prompt the user continuously until a correct value is entered. The program executes continuously until the theater manager enters a negative number to quit. At the end of the program, display the average star rating for the movie.

Answers

Answer:

The program in cpp is given below.

#include <iostream>

using namespace std;

int main()

{

   //variables declared to hold sum, count and average of movie ratings

   int sum=0;

   int count=0;

   int rating;

   double avg;

   //audience is prompted to enter ratings

   do{

       std::cout << "Enter the rating (0 to 4): ";

       cin>>rating;

       if(rating>4)

           std::cout << "Invalid rating. Please enter correct rating again." << std::endl;

       if(rating>=0 && rating<=4)

       {

           sum=sum+rating;

           count++;

       }

       if(rating<0)

           break;

   }while(rating>=0);

   //average rating is computed

   avg=sum/count;

   std::cout << "The average rating for the movie is " << avg << std::endl;  

   return 0;

}

OUTPUT

Enter the rating (0 to 4): 1

Enter the rating (0 to 4): 2

Enter the rating (0 to 4): 0

Enter the rating (0 to 4): 5

Invalid rating. Please enter correct rating again.

Enter the rating (0 to 4): 1

Enter the rating (0 to 4): -1

The average rating for the movie is 1

Explanation:

1. Variables are declared to hold the rating, count of rating, sum of all ratings and average of all the user entered ratings.

2. The variables for sum and count are initialized to 0.

3. Inside do-while loop, user is prompted to enter the rating for the movie.

4. In case the user enters a rating which is out of range, the user is prompted again to enter a rating anywhere from 0 to 4.

5. The loop executes until a negative number is entered.

6. Inside the loop, the running total sum of all the valid ratings is computed and the count variable is incremented by 1 for each valid rating.

7. Outside the loop, the average is computed by dividing the total rating by count of ratings.

8. The average rating is then displayed to the console.

9. The program is written in cpp due to simplicity since all the code is written inside main().

In this question, we give two implementations for the function: def intersection_list(lst1, lst2) This function is given two lists of integers lst1 and lst2. When called, it will create and return a list containing all the elements that appear in both lists. For example, the call: intersection_list([3, 9, 2, 7, 1], [4, 1, 8, 2])could create and return the list [2, 1]. Note: You may assume that each list does not contain duplicate items. a) Give an implementation for intersection_list with the best worst-case runtime. b) Give an implementation for intersection_list with the best average-case runtime.

Answers

Answer:

see explaination

Explanation:

a)Worst Case-time complexity=O(n)

def intersection_list(lst1, lst2):

lst3 = [value for value in lst1 if value in lst2]

return lst3

lst1 = []

lst2 = []

n1 = int(input("Enter number of elements for list1 : "))

for i in range(0, n1):

ele = int(input())

lst1.append(ele) # adding the element

n2 = int(input("Enter number of elements for list2 : "))

for i in range(0, n2):

ele = int(input())

lst2.append(ele) # adding the element

print(intersection_list(lst1, lst2))

b)Average case-time complexity=O(min(len(lst1), len(lst2))

def intersection_list(lst1, lst2):

return list(set(lst1) & set(lst2))

lst1 = []

lst2 = []

n1 = int(input("Enter number of elements for list1 : "))

for i in range(0, n1):

ele = int(input())

lst1.append(ele)

n2 = int(input("Enter number of elements for list2 : "))

for i in range(0, n2):

ele = int(input())

lst2.append(ele)

print(intersection_list(lst1, lst2))

*Sometimes it is difficult to convince top management to commit funds to develop and implement a SIS why*

Answers

Step-by-step Explanation:

SIS stands for: The Student Information System (SIS).

This system (a secure, web-based accessible by students, parents and staff) supports all aspects of a student’s educational experience, and other information. Examples are academic programs, test grades, health information, scheduling, etc.

It is difficult to convince top management to commit funds to develop and implement SIS, this can be due to a thousand reasons.

The obvious is that the management don't see the need for it. They would rather have students go through the educational process the same way they did. Perhaps, they just don't trust the whole process, they feel more in-charge while using a manual process.

Computer A has an overall CPI of 1.3 and can be run at a clock rate of 600 MHz. Computer B has a CPI of 2.5 and can be run at a clock rate of 750 MHz. We have a particular program we wish to run. When compiled for computer A, this program has exactly 100,000 instructions. How many instructions would the program need to have when compiled for Computer B, in order for the two computers to have exactly the same execution time for this program

Answers

Answer:

Check the explanation

Explanation:

CPI means Clock cycle per Instruction

given Clock rate 600 MHz then clock time is Cー 1.67nSec clockrate 600M

Execution time is given by following Formula.

Execution Time(CPU time) = CPI*Instruction Count * clock time = [tex]\frac{CPI*Instruction Count}{ClockRate}[/tex]

a)

for system A CPU time is 1.3 * 100, 000 600 106

= 216.67 micro sec.

b)

for system B CPU time is [tex]=\frac{2.5*100,000}{750*10^6}[/tex]

= 333.33 micro sec

c) Since the system B is slower than system A, So the system A executes the given program in less time

Hence take CPU execution time of system B as CPU time of System A.

therefore

216.67 micro = =[tex]\frac{2.5*Instruction}{750*10^6}[/tex]

Instructions = 216.67*750/2.5

= 65001

hence 65001 instruction are needed for executing program By system B. to complete the program as fast as system A

The number of instructions that the program would need to have when compiled for Computer B is; 65000 instructions

What is the execution time?

Formula for Execution time is;

Execution time = (CPI × Instruction Count)/Clock Time

We are given;

CPI for computer A = 1.3

Instruction Count = 100000

Clock time = 600 MHz = 600 × 10⁶ Hz

Thus;

Execution time = (1.3 * 100000)/(600 × 10⁶)

Execution time(CPU Time) = 216.67 * 10⁻⁶ second

For CPU B;

CPU Time = (2.5 * 100000)/(750 × 10⁶)

CPU Time = 333.33 * 10⁻⁶ seconds

Thus, instructions for computer B for the two computers to have same execution time is;

216.67 * 10⁻⁶ = (2.5 * I)/(750 × 10⁶)

I = (216.67 * 10⁻⁶ * 750 × 10⁶)/2.5

I = 65000 instructions

Read more about programming instructions at; https://brainly.com/question/15683939

Explain possible ways that Darla can communicate with her coworker Terry, or her manager to make sure Joe receives great customer service?

Answers

Answer:

They can communicate over the phone or have meetings describing what is and isn't working for Joe. It's also very important that Darla makes eye contact and is actively listening to effectively handle their customer.

Explanation:

In this puzzle you have a list of n pitchers, with known capacities, c1, c2, ... cn, of holding water in gallons. You have a faucet that can be used as often and as much as the player needs. The goal is to measure exactly g gallons of water, using nothing other than these pitchers. Suppose the current amounts of water that these pitchers hold is w1, w2, ... wn,. These numbers are assumed to be 0 initially. The puzzle is solved as soon as wi = g for any i. A player can perform the following operations:

 Fill pitcher i (from the faucet). The precondition of this operation is: ci > wi ≥ 0. The effect is: wi = ci.

 Empty pitcher i. The precondition of this operation is: ci ≥ wi > 0. The effect is: wi = 0.

 Pour pitcher i to pitcher j. The precondition of this operation is: (ci ≥ wi > 0) and (cj > wj ≥ 0). In words, pitcher i must have some water to pour, and pitcher j must have some unused capacity to receive it. The (partial) effect is: (wi = 0) or (wj = cj) or both. In words, the pour operation must continue until pitcher i becomes empty (and its content is added to pitcher j's content), or pitcher j becomes full (and pitcher i retains the remainder), whichever occurs first. They may occur simultaneously.

A Sample Run

Select the puzzle to solve:

1. Pitchers

2. Eight puzzle

Your selection: 1

Enter the number of pitchers: 3

Enter the capacities of the 3 pitchers (gallons): 2, 5, 10

Enter the goal (gallons): 1

Current configuration: [0, 0, 0]

Please select your next move from the following choices:

1. Fill pitcher 1

2. Fill pitcher 2

3. Fill pitcher 3

Your selection: 2

Current configuration: [0, 5, 0]

Please select your next move from the following choices:

1. Fill pitcher 1

2. Fill pitcher 3

3. Empty pitcher 2

4. Pour pitcher 2 to 1

5. Pour pitcher 2 to 3

Your selection: 4

Current configuration: [2, 3, 0]

Please select your next move from the following choices:

1. Fill pitcher 2

2. Fill pitcher 3

3. Empty pitcher 1

4. Empty pitcher 2

5. Pour pitcher 1 to 2

6. Pour pitcher 1 to 3

7. Pour pitcher 2 to 3

Your selection: 3 Current configuration: [0, 3, 0]

Please select your next move from the following choices:

1. Fill pitcher 1

2. Fill pitcher 2

3. Fill pitcher 3

4. Empty pitcher 2

5. Pour pitcher 2 to 1

6. Pour pitcher 2 to 3

Your selection: 5 Current configuration: [2, 1, 0]

Great! You have reached the goal in 4 moves. Bye.

Answers

Answer:

See explaination

Explanation:

#include <iostream>

#include <vector>

using namespace std;

// function to print configuration for each pitcher

void printConfig(vector<int> w, int n)

{

cout << "Current configuration: [" << w[0];

for(int i=1; i<n; i++)

{

cout << ", " << w[i];

}

cout << "]" << endl;

}

void getOptions(vector<int> c, vector<int> w, int n, vector<pair<int, pair<int, int>>> &options)

{

// options count

int count = 0;

// fill

for(int i=0; i<n; i++)

{

if(c[i] > w[i] && w[i] >= 0)

{

count ++;

cout << count << ". Fill pitcher " << (i+1) << endl;

// add options to list

options.push_back(make_pair(1, make_pair(i, 0)));

}

}

// empty

for(int i=0; i<n; i++)

{

if(c[i] >= w[i] && w[i] > 0)

{

count++;

cout << count << ". Empty pitcher " << (i+1) << endl;

// add options to list

options.push_back(make_pair(2, make_pair(i, 0)));

}

}

// Pour pitcher i to pitcher j

for(int i=0; i<n; i++)

{

if(c[i] >= w[i] && w[i] > 0)

{

for(int j=0; j<n; j++)

{

if(i!=j && c[j] > w[j] && w[j] >= 0)

{

count++;

cout << count << ". Pour pitcher " << (i+1) << " to " << (j+1) << endl;

// add options to list

options.push_back(make_pair(3, make_pair(i, j)));

}

}

}

}

}

void execute(vector<int> c, vector<int> &w, pair<int, pair<int, int>> option)

{

int i = option.second.first;

// for fill

if(option.first == 1)

{

w[i] = c[i];

}

// empty

else if(option.first == 2)

{

w[i] = 0;

}

// pour

else

{

int j = option.second.second;

if(w[i] >= c[j])

{

w[i] = w[i] - c[j];

w[j] = c[j];

}

else

{

w[j] = w[i];

w[i] = 0;

}

}

}

int main()

{

// required variables

int choice, n, temp, g, flag, moves = 0;

// vectors are dynamic sized arrays

vector<int> c, w;

vector<pair<int, pair<int, int>>> options;

// select puzzle

cout << "Select the puzzle to solve:\n";

cout << "1. Pitchers\n";

cout << "2. Eight puzzle\n";

cout << "Your selection: ";

cin >> choice;

if(choice == 1)

{

// input values required

cout << "Enter the number of pitchers: ";

cin >> n;

// array for pitchers

cout << "Enter the capacities of the " << n << " pitchers (gallons): ";

for(int i=0; i<n; i++)

{

cin >> temp;

c.push_back(temp);

w.push_back(0);

}

cout << "Enter the goal (gallons): ";

cin >> g;

// start game

while(true)

{

// print configuration

printConfig(w, n);

// check for goal state

flag = 0;

for(int i=0; i<n; i++)

{

if(w[i] == g)

{

flag = 1;

break;

}

}

if(flag)

{

cout << "Great! You have reached the goal in " << moves << " moves. Bye." << endl;

break;

}

// get and print options

//empty previous options

options.clear();

getOptions(c, w, n, options);

// ask for user's selection

cout << "Your selection: ";

cin >> choice;

// update moves

moves++;

// perform according to the selection

execute(c, w, options[choice-1]);

}

}

return 0;

}

Create a macro named mReadInt that reads a 16- or 32-bit signed integer from standard input and returns the value in an argument. Use conditional operators to allow the macro to adapt to the size of the desired result. Write a program that tests the macro, passing it operands of various sizes.

Answers

Answer:

;Macro mReadInt definition, which take two parameters

;one is the variable to save the number and other is the length

;of the number to read (2 for 16 bit and 4 for 32 bit) .

%macro mReadInt 2

mov eax,%2

cmp eax, "4"

je read2

cmp eax, "2"

je read1

read1:

mReadInt16 %1

cmp eax, "2"

je exitm

read2:

mReadInt32 %1

exitm:

xor eax, eax

%endmacro

;macro to read the 16 bit number, parameter is number variable

%macro mReadInt16 1

mov eax, 3

mov ebx, 2

mov ecx, %1

mov edx, 5

int 80h

%endmacro

;macro to read the 32 bit number, parameter is number variable

%macro mReadInt32 1

mov eax, 3

mov ebx, 2

mov ecx, %1

mov edx, 5

int 80h

%endmacro

;program to test the macro.

;data section, defining the user messages and lenths

section .data

userMsg db 'Please enter the 32 bit number: '

lenUserMsg equ $-userMsg

userMsg1 db 'Please enter the 16 bit number: '

lenUserMsg1 equ $-userMsg1

dispMsg db 'You have entered: '

lenDispMsg equ $-dispMsg

;.bss section to declare variables

section .bss

;num to read 32 bit number and num1 to rad 16-bit number

num resb 5

num1 resb 3

;.text section

section .text

;program start instruction

global _start

_start:

;Displaying the message to enter 32bit number

mov eax, 4

mov ebx, 1

mov ecx, userMsg

mov edx, lenUserMsg

int 80h

;calling the micro to read the number

mReadInt num, 4

;Printing the display message

mov eax, 4

mov ebx, 1

mov ecx, dispMsg

mov edx, lenDispMsg

int 80h

;Printing the 32-bit number

mov eax, 4

mov ebx, 1

mov ecx, num

mov edx, 4

int 80h

;displaying message to enter the 16 bit number

mov eax, 4

mov ebx, 1

mov ecx, userMsg1

mov edx, lenUserMsg1

int 80h

;macro call to read 16 bit number and to assign that number to num1

;mReadInt num1,2

;calling the display mesage function

mov eax, 4

mov ebx, 1

mov ecx, dispMsg

mov edx, lenDispMsg

int 80h

;Displaying the 16-bit number

mov eax, 4

mov ebx, 1

mov ecx, num1

mov edx, 2

int 80h

;exit from the loop

mov eax, 1

mov ebx, 0

int 80h

Explanation:

For an assembly code/language that has the conditions given in the question, the program that tests the macro, passing it operands of various sizes is given below;

;Macro mReadInt definition, which take two parameters

;one is the variable to save the number and other is the length

;of the number to read (2 for 16 bit and 4 for 32 bit) .

%macro mReadInt 2

mov eax,%2

cmp eax, "4"

je read2

cmp eax, "2"

je read1

read1:

mReadInt16 %1

cmp eax, "2"

je exitm

read2:

mReadInt32 %1

exitm:

xor eax, eax

%endmacro

;macro to read the 16 bit number, parameter is number variable

%macro mReadInt16 1

mov eax, 3

mov ebx, 2

mov ecx, %1

mov edx, 5

int 80h

%endmacro

;macro to read the 32 bit number, parameter is number variable

%macro mReadInt32 1

mov eax, 3

mov ebx, 2

mov ecx, %1

mov edx, 5

int 80h

%endmacro

;program to test the macro.

;data section, defining the user messages and lenths

section .data

userMsg db 'Please enter the 32 bit number: '

lenUserMsg equ $-userMsg

userMsg1 db 'Please enter the 16 bit number: '

lenUserMsg1 equ $-userMsg1

dispMsg db 'You have entered: '

lenDispMsg equ $-dispMsg

;.bss section to declare variables

section .bss

;num to read 32 bit number and num1 to rad 16-bit number

num resb 5

num1 resb 3

;.text section

section .text

;program start instruction

global _start

_start:

;Displaying the message to enter 32bit number

mov eax, 4

mov ebx, 1

mov ecx, userMsg

mov edx, lenUserMsg

int 80h

;calling the micro to read the number

mReadInt num, 4

;Printing the display message

mov eax, 4

mov ebx, 1

mov ecx, dispMsg

mov edx, lenDispMsg

int 80h

;Printing the 32-bit number

mov eax, 4

mov ebx, 1

mov ecx, num

mov edx, 4

int 80h

;displaying message to enter the 16 bit number

mov eax, 4

mov ebx, 1

mov ecx, userMsg1

mov edx, lenUserMsg1

int 80h

;macro call to read 16 bit number and to assign that number to num1

;mReadInt num1,2

;calling the display mesage function

mov eax, 4

mov ebx, 1

mov ecx, dispMsg

mov edx, lenDispMsg

int 80h

;Displaying the 16-bit number

mov eax, 4

mov ebx, 1

mov ecx, num1

mov edx, 2

int 80h

;exit from the loop

mov eax, 1

mov ebx, 0

int 80h

Retail price data for n = 60 hard disk drives were recently reported in a computer magazine. Three variables were recorded for each hard disk drive: y = Retail PRICE (measured in dollars) x1 = Microprocessor SPEED (measured in megahertz) (Values in sample range from 10 to 40) x2 = CHIP size (measured in computer processing units) (Values in sample range from 286 to 486) A first-order regression model was fit to the data. Part of the printout follows: __________.

Answers

Answer:

Explanation:

Base on the scenario been described in the question, We are 95% confident that the price of a single hard drive with 33 megahertz speed and 386 CPU falls between $3,943 and $4,987

Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string.

Ex: If the input is:

n Monday
the output is:

1
Ex: If the input is:

z Today is Monday
the output is:

0
Ex: If the input is:

n It's a sunny day
the output is:

2
Case matters.

Ex: If the input is:

n Nobody
the output is:

0
n is different than N.





This is what i have so far.
#include
#include
using namespace std;

int main() {

char userInput;
string userStr;
int numCount;

cin >> userInput;
cin >> userStr;

while (numCount == 0) {
cout << numCount << endl;
numCount = userStr.find(userInput);

}
return 0;
}


Answers

Here is a Python program:

tmp = input().split(' ')
c = tmp[0]; s = tmp[1]
ans=0
for i in range(len(s)):
if s[i] == c: ans+=1

# the ans variable stores the number of occurrences
print(ans)

You work at a cheeseburger restaurant. Write a program that determines appropriate changes to a food order based on the user’s dietary restrictions. Prompt the user for their dietary restrictions: vegetarian, lactose intolerant, or none. Then using if statements and else statements, print the cook a message describing how they should modify the order. The following messages should be used: - If the user enters "lactose intolerant", say "No cheese." - If the user enters "vegetarian", say "Veggie burger." - If the user enters "none", say "No alterations."

Answers

Answer:

See explaination

Explanation:

dietary_restrictions = input("Any dietary restrictions?: ")

if dietary_restrictions=="lactose intolerant":

print("No cheese")

elif dietary_restrictions == "vegetarian":

print("Veggie burger")

else:

print("No alteration")

The Monte Carlo (MC) Method (Monte Carlo Simulation) was first published in 1949 by Nicholas Metropolis and Stanislaw Ulam in the work "The Monte Carlo Method" in the Journal of American Statistics Association. The name Monte Carlo has its origins in the fact that Ulam had an uncle who regularly gambled at the Monte Carlo casino in Monaco. In fact, way before 1949 the method had already been extensively used as a secret project of the U.S. Defense Department during the so-called "Manhattan Project". The basic principle of the Monte Carlo Method is to implement on a computer the Strong Law of Large Numbers (SLLN) (see also Lecture 9). The Monte Carlo Method is also typically used as a probabilistic method to numerically compute an approximation of a quantity that is very hard or even impossible to compute exactly like, e.g., integrals (in particular, integrals in very high dimensions!). The goal of Problem 2 is to write a Python code to estimate the irrational number

Answers

Answer:

can you give more detail

Explanation:

Assume the class Student implements the Speaker interface from the textbook. Recall that this interface includes two abstract methods, speak( ) and announce(String str). A Student contains one instance data, String class Rank. Write the Student class so that it implements Speaker as follows. The speak method will output "I am a newbie here" if the Student is a "Freshman", "I like my school" if the Student is either a "Sophomore" or a "Junior", or "I can not wait to graduate" if the student is a "Senior". The announce method will output "I am a Student, here is what I have to say" followed by the String parameter on a separate line. Finally, the class Rank is initialized in the constructor. Only implement the constructor and the methods to implement the Speaker interface.

Answers

Answer:

Check the explanation

Explanation:

Based on the above information, this the following resulting code.

The solution has namely one interface named Speaker, one class called Student and one Main class called StudentMain.

The StudentMain class just initialize various instances of the Student class with various classRank values and then subsequently calling in the speak() methods of all.

announce() method is called on one such instance of Student class to demonstrate its functioning.

Comments are added at required place to better help in understanding the logic.

Speaker.java

public interface Speaker {

 

  abstract void speak();

  abstract void announce(String str);

}

Student.java

public class Student implements Speaker {

  /*

  * Write the Student class so that it implements Speaker as follows.

  The speak method will output "I am a newbie here" if the Student is a "Freshman",

  "I like my school" if the Student is either a "Sophomore" or a "Junior",

  or "I can not wait to graduate" if the student is a "Senior".

  The announce method will output "I am a Student, here is what I have to say" followed by the String parameter on a separate line.

  */

  String classRank;

 

 

  // Based on the requirement taking in classRank String as a constructor parameter

  public Student(String classRank) {

      super();

      this.classRank = classRank;

  }

// Using the switch-case to code the above requirment

  public void speak() {

      switch(classRank) {

     

      case "Freshman":

          System.out.println("I am a newbie here");

          break;

      // This case would output the same result for the 2 case conditions

      case "Sophomore":

      case "Junior":

          System.out.println("I like my school");

          break;

         

      case "Senior":

          System.out.println("I can not wait to graduate");

          break;

      default:

          System.out.println("Unknown classRank inputted");

      }

     

  }

  //Based on the requirement, first line is printed first after second which is

  // the inputted String parameter

  public void announce(String str) {

      System.out.println("I am a Student, here is what I have to say");

      System.out.println(str);

  }

}

StudentMain.java

public class StudentMain {

 

  public static void main(String[] args) {

     

      // Initializing all the Objects with required classRank

      Student stu1=new Student("Freshman");

      Student stu2=new Student("Sophomore");

      Student stu3=new Student("Junior");

      Student stu4=new Student("Senior");

      Student stu5=new Student("Freshman");

     

      //Calling the speak methods of the all the above create objects

      stu1.speak();

      stu2.speak();

      stu3.speak();

      stu4.speak();

      stu4.speak();

      stu4.announce("Wish u all the best");

  }

}

Following is the output generated from the code run.

Create a classRationalNumber(fractions, see problem 11.15 p.639) with the following capabilities:a) Create a constructor that prevents 0 on the denominator in a fraction, reduces (or simplifies) fractionsthat are not in reduced form (lowest terms), and avoids negative denominatorsb) Overload the addition, subtraction, multiplication, and division operators for this class.c) Overload the relationaland equality == operators for this class.Test all member functions and overloaded operators.

Answers

Answer:

See explaination

Explanation:

#include<iostream>

using namespace std;

class a

{

int i,n,d,sn,sd,cond;

public:

void getdata()

{

cout<<"Enter the numerator"<<endl;

cin>>n;

cout<<"Enter the denominator"<<endl;

cin>>d;

}

void operator+(a a1)

{

if(a1.d!=d)

{

sn=(a1.n*d)+(n*a1.d);

sd=(a1.d)*(d);

}

else

{

sn=a1.n+n;

sd=a1.d;

}

if(sn>sd)

{

cond=sd;

}

else if(sd>sn)

{

cond=sn;

}

}

void sum()

{

for(i=2;i<=cond;i++)

{

if(sn%i==0 && sd%i==0)

{

sn=sn/i;

sd=sd/i;

}

}

cout<<"Sum is "<<sn<<"/"<<sd<<endl;

}

a operator-(a a1)

{

a a3;

if(a1.d!=d)

{

a3.sn=(a1.n*d)-(n*a1.d);

a3.sd=(a1.d)*(d);

}

else

{

a3.sn=a1.n-n;

a3.sd=a1.d;

}

return a3;

}

void sub()

{

if(sn>sd)

{

cond=sd;

}

else if(sd>sn)

{

cond=sn;

}

for(i=2;i<=cond;i++)

{

if(sn%i==0 && sd%i==0)

{

sn=sn/i;

sd=sd/i;

}

}

cout<<"Subtraction is "<<sn<<"/"<<sd<<endl;

}

a operator /(a a1)

{

a a4;

a4.sn=a1.n*d;

a4.sd=a1.d*n;

return a4;

}

void div()

{

if(sn>sd)

{

cond=sd;

}

else if(sd>sn)

{

cond=sn;

}

else if(sn==sd)

{

sn=1;

sd=1;

}

for(i=2;i<=cond;i++)

{

if(sn%i==0 && sd%i==0)

{

sn=sn/i;

sd=sd/i;

}

}

cout<<"Division is "<<sn<<"/"<<sd<<endl;

}

a operator*(a a1)

{

a a5;

a5.sn=a1.n*n;

a5.sd=a1.d*d;

return a5;

}

void mul()

{

if(sn>sd)

{

cond=sd;

}

else if(sd>sn)

{

cond=sn;

}

for(i=2;i<=cond;i++)

{

if(sn%i==0 && sd%i==0)

{

sn=sn/i;

sd=sd/i;

}

}

cout<<"Multiplication - "<<sn<<"/"<<sd<<endl;

}

};

int main()

{

a a1,a2,a3,a4,a5,a6;

a1.getdata();

a2.getdata();

a2+(a1);

a2.sum();

a3=a2-(a1);

a3.sub();

a4=a2/(a1);

a4.div();

a5=a2*(a1);

a5.mul();

return 0;

}

Design an application for Bob's E-Z Loans. The application accepts a client's loan amount and monthly payment amount. Output the customer's loan balance each month until the loan is paid off. b. Modify the Bob's E-Z Loans application so that after the payment is made each month, a finance charge of 1 percent is added to the balance.

Answers

Answer:

part (a).

The program in cpp is given below.

#include <stdio.h>

#include <iostream>

using namespace std;

int main()

{

   //variables to hold balance and monthly payment amounts

   double balance;

   double payment;

   //user enters balance and monthly payment amounts

   std::cout << "Welcome to Bob's E-Z Loans application!" << std::endl;

   std::cout << "Enter the balance amount: ";

   cin>>balance;

   std::cout << "Enter the monthly payment: ";

   cin>>payment;

   std::cout << "Loan balance: " <<" "<< "Monthly payment: "<< std::endl;

   //balance amount and monthly payment computed

   while(balance>0)

   {

       if(balance<payment)    

         { payment = balance;}

       else

       {  

           std::cout << balance <<"\t\t\t"<< payment << std::endl;

           balance = balance - payment;

       }

   }

   return 0;

}

part (b).

The modified program from part (a), is given below.

#include <stdio.h>

#include <iostream>

using namespace std;

int main()

{

   //variables to hold balance and monthly payment amounts

   double balance;

   double payment;

   double charge=0.01;

   //user enters balance and monthly payment amounts

   std::cout << "Welcome to Bob's E-Z Loans application!" << std::endl;

   std::cout << "Enter the balance amount: ";

   cin>>balance;

   std::cout << "Enter the monthly payment: ";

   cin>>payment;

   balance = balance +( balance*charge );

   std::cout << "Loan balance with 1% finance charge: " <<" "<< "Monthly payment: "<< std::endl;

   //balance amount and monthly payment computed

   while(balance>payment)

   {

           std::cout << balance <<"\t\t\t\t\t"<< payment << std::endl;

           balance = balance +( balance*charge );

           balance = balance - payment;

       }

   if(balance<payment)    

         { payment = balance;}          

   std::cout << balance <<"\t\t\t\t\t"<< payment << std::endl;

   return 0;

}

Explanation:

1. The variables to hold the loan balance and the monthly payment are declared as double.

2. The program asks the user to enter the loan balance and monthly payment respectively which are stored in the declared variables.  

3. Inside a while loop, the loan balance and monthly payment for each month is computed with and without finance charges in part (a) and part (b) respectively.

4. The computed values are displayed for each month till the loan balance becomes zero.

5. The output for both part (a) and part (b) are attached as images.

Which of the following should be the first page of a report?
O Title page
Introduction
O Table of contents
Terms of reference

Answers

Answer:

Title page should be the first page of a report.

hope it helps!

Trace the complete execution of the MergeSort algorithm when called on the array of integers, numbers, below. Show the resulting sub-arrays formed after each call to merge by enclosing them in { }. For example, if you originally had an array of 5 elements, a = {5,2,8,3,7}, the first call to merge would result with: {2, 5} 8, 3, 7 ← Note after the first call to merge, two arrays of size 1 have been merged into the sorted subarray {2,5} and the values 2 and 5 are sorted in array a You are to do this trace for the array, numbers, below. Be sure to show the resulting sub-arrays after each call to MergeSort. int[] numbers = {23, 14, 3, 56, 17, 8, 42, 18, 5};

Answers

Answer:

public class Main {

public static void merge(int[] arr, int l, int m, int r) {

int n1 = m - l + 1;

int n2 = r - m;

int[] L = new int[n1];

int[] R = new int[n2];

for (int i = 0; i < n1; ++i)

L[i] = arr[l + i];

for (int j = 0; j < n2; ++j)

R[j] = arr[m + 1 + j];

int i = 0, j = 0;

int k = l;

while (i < n1 && j < n2) {

if (L[i] <= R[j]) {

arr[k] = L[i];

i++;

} else {

arr[k] = R[j];

j++;

}

k++;

}

while (i < n1) {

arr[k] = L[i];

i++;

k++;

}

while (j < n2) {

arr[k] = R[j];

j++;

k++;

}

printArray(arr, l, r);

}

public static void sort(int[] arr, int l, int r) {

if (l < r) {

int m = (l + r) / 2;

sort(arr, l, m);

sort(arr, m + 1, r);

merge(arr, l, m, r);

}

}

static void printArray(int[] arr, int l, int r) {

System.out.print("{");

for (int i = l; i <= r; ++i)

System.out.print(arr[i] + " ");

System.out.println("}");

}

public static void main(String[] args) {

int[] arr = {23, 14, 3, 56, 17, 8, 42, 18, 5};

sort(arr, 0, arr.length - 1);

}

}

Explanation:

See answer

Other Questions
The manufacturing overhead budget at Cutchin Corporation is based on budgeted direct labor-hours. The direct labor budget indicates that 2,800 direct labor-hours will be required in September. The variable overhead rate is $7.00 per direct labor-hour. The companys budgeted fixed manufacturing overhead is $43,120 per month, which includes depreciation of $3,640. All other fixed manufacturing overhead costs represent current cash flows. The September cash disbursements for manufacturing overhead on the manufacturing overhead budget should be: Elsie starts a food blog. In the first month, there are 46 new subscribers. Each month after that, the number of new subscribersincreases by 15 more than the number of new subscribers in the previous month. At this rate, what will be the total number ofsubscribers after 8 months?788394151848 How many moles are there in 135g of aluminum ? In the diagram, which angles form a linear pair? Selectthree options How is the organism in bread used? the diagram above represents a reflex arc in a human. This pathway responds when someone touches something that causes pain, such as a hot stove. Which of the following shows the correct order of the body systems involved in this response?A) Integumentary, respiratory, digestiveB) Circulatory, respiratory, nervousC) Integumentary, nervous, muscularD) Circulatory, digestive, nervous There are 81 women teachers at Russell High. If 45% of the teachers in the school are women, how many teachers are there at Russell High? A fraction that is equivalent to 6/-5? The body mass index (BMI) of an individual is a measure used to judge whether or not an individual is overweight. A BMI between 20 and 25 indicated a normal weight. In a survey of 750 men and 750 women, the Gallup organization found that 203 men and 270 women were normal weight. Construct a 95% confidence interval for the difference in proportion of men and women who are normal weight. sintetizar el relato sobre la alegoria de Platn (a) Show how two 2-to-1 multiplexers (with no added gates) could be connected to form a 3-to-1 MUX. Input selection should be as follows: If AB = 00, select I0 If AB = 01, select I1 If AB = 1 (B is a dont-care), select I2 (b) Show how two 4-to-1 and one 2-to-1 multiplexers could be connected to form an 8-to-1 MUX with three control inputs. (c) Show how four 2-to-1 and one 4-to-1 multiplexers could be connected to form an 8-to-1 MUX with three control inputs What happens during interphase that allows the two resulting cells to be the same as theoriginal cell? Which sentence is true?A. - 3 > - 7B. - 2 < -9C. 4 < -1D. - 5 > 0 A local retailer claims that the mean waiting time is less than 8 minutes. A random sample of 20 waiting times has a mean of 6.3 minutes with a standard deviation of 2.1 minutes. At = 0.01, test the retailer's claim. Assume the distribution is normally distributed. Round the test statistic to the nearest thousandth. Classify this triangle. Acute scalene triangle Obtuse isosceles triangle Right isosceles triangle Right scalene triangle Hattie accepted a job as a makeup artist after being offered a $550 signingbonus. If she makes $32 an hour, which equation models Hattie's total pay y,in dollars, as it relates to the number of hours x that she works? You buy a classic comic book for $45. You want to resell it and make a $15 profit. What percent do you need to markup the comic book? Read this excerpt from Weve Got a Job: The 1963 Childrens March.When Arnetta Streeter was in elementary school, she wanted to become a nun. She loved the nuns who taught at St. Mary's, the Catholic school she attended through third grade. Arnetta said they were "very, very strict," and she liked the discipline and high academic expectations.Which part of the narrative structure does the author develop in this excerpt?A.Plot is developed as Arnetta experiences the highs and lows of a school day.B.Characterization is developed, showing Arnettas enthusiasm for school.C.Conflict is developed as Arnetta is disciplined by the nuns at her school.D.Setting is developed, revealing the layout of Arnettas school building. Which of the following contributed to the formation of feudalism?A. People longer to reunite the territories of the Roman empire. B. People could not afford to pay taxes to the king.C. people were devoted to the Catholic Church and wanted to be obedient.D. people wanted the protection that the nobles could provide them. Verbes replacer : ouvrir, offrir, cueillir, (se) couvrir, dcouvrir, accueillir, souffrir 1. Le matin, ma sur toujours la fentre de sa chambre. 2. Mes parents les cerises au mois de juin. 3. Nous de nouvelles histoires chaque fois que nous un livre. 4. Vous nous toujours bras ouverts, c'est pourquoi nous vous ce petit cadeau. 5. Tu ne te pas assez pour sortir dans le froid ! 6. Elle ne pas trop avec cette chaleur ?