Answer:
In this case, the country that produces rye will produce 24 million bushels per week, and the country that produces jeans will produce 64 million pairs per week.
Explanation:
Total labor hour = 4 million hour
Number of bushes produce in 1 hour = 6
⇒total bushes produce = 6*4 = 24 million
∴ we get
The country that produces rye will produce 24 million bushels per week
Now,
Total labor hour = 4 million hour
Number of pairs produce in 1 hour = 16
⇒total bushes produce = 16*4 = 64 million
∴ we get
The country that produces jeans will produce 64 million pairs per week.
When importing data using the Get External Data tools on the Data tab, what wizard is automatically
started after selecting the file you want, to help import the data?
Text Import Wizard
Excel Data Wizard
Import Wizard
Text Wrap Wizard
Answer: text import wizard
Explanation:
Consider the following code segment. int[][] arr = {{3, 2, 1}, {4, 3, 5}}; for (int row = 0; row < arr.length; row++) { for (int col = 0; col < arr[row].length; col++) { if (col > 0) { if (arr[row][col] >= arr[row][col - 1]) { System.out.println("Condition one"); } } if (arr[row][col] % 2 == 0) { System.out.println("Condition two"); } } } As a result of executing the code segment, how many times are "Condition one" and "Condition two" printed?
Answer:
Condition one - 1 time
Condition two - 2 times
Explanation:
Given
The above code segment
Required
Determine the number of times each print statement is executed
For condition one:
The if condition required to print the statement is: if (arr[row][col] >= arr[row][col - 1])
For the given data array, this condition is true only once, when
[tex]row = 1[/tex] and [tex]col = 2[/tex]
i.e.
if(arr[row][col] >= arr[row][col - 1])
=> arr[1][2] >= arr[1][2 - 1]
=> arr[1][2] >= arr[1][1]
=> 5 >= 3 ---- True
The statement is false for other elements of the array
Hence, Condition one is printed once
For condition two:
The if condition required to print the statement is: if (arr[row][col] % 2 == 0)
The condition checks if the array element is divisible by 2.
For the given data array, this condition is true only two times, when
[tex]row = 0[/tex] and [tex]col = 1[/tex]
[tex]row = 1[/tex] and [tex]col = 0[/tex]
i.e.
if (arr[row][col] % 2 == 0)
When [tex]row = 0[/tex] and [tex]col = 1[/tex]
=>arr[0][1] % 2 == 0
=>2 % 2 == 0 --- True
When [tex]row = 1[/tex] and [tex]col = 0[/tex]
=>arr[1][0] % 2 == 0
=> 4 % 2 == 0 --- True
The statement is false for other elements of the array
Hence, Condition two is printed twice
The reason why our computers can get faster without getting bigger is because of...
A. Moore's Law
B. Turing Test
C. The programming system of the ENIAC
D. The popularity of the personal computer
Drag the tiles to the correct boxes to complete the pairs.
Match each type of database to its application
Multistage
Stationary
Distributed
Virtual
used for concise as well as detailed
historical data
arrowRight
used where access to data is rare
arrowRight
used for accessing data in diverse
applications using middleware
arrowRight
used by an organization that runs
several businesses
arrowRight
Answer:
1. Multistage database.
2. Stationary database.
3. Virtual database.
4. Distributed database.
Explanation:
A database management system (DBMS) can be defined as a collection of software applications that typically enables computer users to create, store, modify, retrieve and manage data or informations in a database. Generally, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security.
There are four (4) major types of database in a data warehouse and these are;
1. Multistage database: used for concise as well as detailed historical data. It provides summarized data which can be used by an employee for short-term decision making.
2. Stationary database: used where access to data is rare i.e business firms who do not access data frequently. In order to use this database, the users must have an access to metadata store and thus, directly having access to the data on a source system.
3. Virtual database: used for accessing data in diverse applications using middleware. This type of database is dependent on having access to information on various databases.
4. Distributed database: used by an organization that runs several businesses. Therefore, this type of database are usually located or situated in various geographical regions.
Modify your main.c file so that it allocates a two dimensional array of integers so that the array has 20 rows of 30 integers in each row. Fill up the entire array so that the first row contains 0-29 the second row contains 1-30, the third row contains 2-31 and so on until the last row contains 19-48. Print the results in a grid so that your output looks like:
Answer:
Explanation:
b
Which statement is most likely to be true about a computer network?
Answer:
the answer is b
Explanation:
hope this helps
Answer:
A network can have several client computers and only one server.
Explanation:
(Confirmed on Edge)
I hope this helped!
Good luck <3
11.4 Simple Arithmetic Program
For this lab, you will write a Java program to prompt the user to enter two integers. Your program will display a series of arithmetic
operations using those two integers.
Sample Output: This is a sample
transcript of what your program should do. Items in bold are user input and should not be put on the
screen by your program. Make sure your output looks EXACTLY like the output below, including spacing. Items in bold are elements input by
the user, not hard-coded into the program.
Enter the first number: 12
Enter the second number: 3
12 + 3 = 15
12 - 3 = 9
12 * 3 = 36
12 / 3 = 4
12% 3 = 0
The average of your two numbers is: 7
A second run of your program with different inputs might look like this:
Enter the first number: -4
Enter the second number: 3
-4 + 3 = -1
-4 3 = -7
-4 * 3 = -12
-4 / 3 = -1
-4 % 3 = -1
The average of your two numbers is: 0
raico 2 of Closedlani That code takes in a single number and
Answer:
not yet di ko po alam
Explanation:
kasi po wala po ako mhanap na sagot thanks
po
Design a program that generates a seven-digit lottery number. The program should generate seven random numbers, each in the range of 0 through 9, and assign each number to a list element. (Random numbers were discussed in Chapter 5 (Links to an external site.).) Then write another loop that displays the contents of the list
Answer:
In Python:
import random
lotterylist = []
for number in range(7):
lotterylist.append(random.randint(0,9))
for number in lotterylist:
print(number, end = ', ')
Explanation:
This line imports the random library
import random
This line creates an empty list
lotterylist = []
The instructions in this loop will be performed 7 times
for number in range(7):
This line generates a random number between 0 and 9 (inclusive) and then appends the number into lotterylist
lotterylist.append(random.randint(0,9))
This iterates through lotterylist
for number in lotterylist:
This prints the content of the list on a line (seperated by comma)
print(number, end = ', ')
Write a program that reads in the text file attached, converts all words to lowercase, and prints out all words in the file that begin with that key letter a, the letter b, and so on. Build a dictionary whose keys are the lowercase letters, and whose values are sets of words which begin with that key letter. After processing the data, print the dictionary to the screen in alphabetical order aligned in two fixed sized columns. Such as:
Answer:
Follows are the code to this question:
def dic_sorted(data):#defining a method print_dic_sorted
s = data.split()#defining a variable that use split method
d = {} #defining a dictionary
alpha = '0123456789abcdefghijklmnopqrstuvwxyz' #defining a variable alpha that hold english alphabets values
for k in alpha:#defining for loop that stores values in the dictionary
d[k]= set()# use dictionary to set value in list
for i in s:# defining for loop to convert value in lower case
i = i.lower() #convert value into lower case by using lower method
a = i[0]# adding value into dictionary
d[a].add(i) # use add method to hold value in dictionary
for k,v in sorted(d.items()):#use for loop to convert value in assending order
if len(d[k])!=0: #use if block to check length of dictionary
print(k,":", sorted(v))#use print to sort value
f_name = 'input.txt'#defining a variable that open file
with open(f_name) as fi:#use open method to read file
data = fi.read() # read file data
dic_sorted(data)#calling method
output:
please find the attached file.
Explanation:
In the code, the "dic_sorted" method is used, which accepts a data variable as a parameter, and inside the method, a split method and an empty dictionary are defined, that converts and holds the value by alphabetical order, for this it defines three for loops.
In the first for loop, it holds a value in the dictionary, and in the second loop it converts a value into the lower case, and in the third loop, it stores the value in its alphabetical order.
Given that the variable named Boy = "Joey" and the variable named Age = 6, create statements that will output the following message:
Congratulations, Joey! Today you are 6 years old.
First, write one statement that will use a variable named Message to store the message. (You will need to concatenate all of the strings and variables together into the one variable named Message. If you don't know what that means, read the section in Chapter 1 about concatenation.)
Then write a second statement that will simply output the Message variable.
Answer:
isn't it already showing it if not put text box
Explanation:
Write a program to help a local restaurant automate its breakfast billing system. The program should do the following:
Show the customer the different breakfast items offered by the restaurant.
Allow the customer to select more than one item from the menu.
Calculate and print the bill.
Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item):
Food Price
Plain Egg $1.45
Bacon and Egg $2.45
Muffin $0.99
French Toast $1.99
Fruit Basket $2.49
Cereal $0.69
Coffee $0.50
Tea $0.75
Use an array menuList of type menuItemType, as defined in Programming Exercise 3. Your program must contain at least the following functions:
Function getData: This function loads the data into the array menuList.
Function showMenu: This function shows the different items offered by the restaurant and tells the user how to select the items.
Function printCheck: This function calculates and prints the check. (Note that the billing amount should include a 5% tax.)
A sample output is:
Welcome to Johnny's Resturant
----Today's Menu----
1: Plain Egg $1.45
2: Bacon and Egg $2.45
3: Muffin $0.99
4: French Toast $1.99
5: Fruit Basket $2.49
6: Cereal $0.69
7: Coffee $0.50
8: Tea $0.75
You can make up to 8 single order selections
Do you want to make selection Y/y (Yes), N/n (No): Y
Enter item number: 1
Select another item Y/y (Yes), N/n (No): Y
Enter item number: 2
Select another item Y/y (Yes), N/n (No): N
Welcome to Johnny's Resturant
Plain Egg $1.45
Bacon and Egg $2.45
Tax $0.20
Amount Due $4.10
Format your output with two decimal places. The name of each item in the output must be left justified. You may assume that the user selects only one item of a particular type.
Answer:
Please find the code and its output in the attached file:
Explanation:
In this code a structure "menuItemType" is defined that declared float and integer variable and outside the structure its list type variable "menuList" is defined that holds and calculates its value.
In the next step, a class "Rest" is defined, and inside the class a method "getData", "showMenu", and "printCheck" is defined, in which the above methods uses the switch for input and calculate the value and the last "printCheck" calculates the Tax and Amount Due value.
In the main method, a class object is created that prints message and call the above method.
Mark is a stockbroker in New York City. He recently asked you to develop a program for his company. He is looking for a program that will calculate how much each person will pay for stocks. The amount that the user will pay is based on:
The number of stocks the Person wants * The current stock price * 20% commission rate.
He hopes that the program will show the customer’s name, the Stock name, and the final cost.
The Program will need to do the following:
Take in the customer’s name.
Take in the stock name.
Take in the number of stocks the customer wants to buy.
Take in the current stock price.
Calculate and display the amount that each user will pay.
A good example of output would be:
May Lou
you wish to buy stocks from APPL
the final cost is $2698.90
ok sorry i cant help u with this
Effects of disregarding to ignoring computer problems
In the following code segment, assume that the ArrayList numList has been properly declared and initialized to contain the Integer values [1, 2, 2, 3]. The code segment is intended to insert the Integer value val in numList so that numList will remain in ascending order. The code segment does not work as intended in all cases.
int index = 0;
while (val > numList.get(index))
{
index++;
}
numList.add(index, val);
For which of the following values of val will the code segment not work as intended?
a. 0
b. 1
c. 2
d. 3
e. 4
Answer:
e. 4
Explanation:
The code segment will not work as intended if the value of the variable val is 4. This is because the while loop is comparing the value of the variable val to the value of each element within the numList. Since there is no element that is bigger than or equal to the number 4, this means that if the variable val is given the value of 4 it will become an infinite loop. This would cause the program to crash and not work as intended.
The program illustrates the use of while loops.
The code segment will not work as intended when the value of val is 4
LoopsLoops are used to perform repeated operations
The programFrom the program, the while loop is repeated under the following condition:
val > numList.get(index)
This means that:
The loop is repeated as long as val has a value greater than the index of numList (i.e. 3)
From the list of options, 4 is greater than 3.
Hence, the code segment will not work as intended when the value of val is 4
Read more about loops at:
https://brainly.com/question/19344465
Write a lottery program that will ask the user if they would like to pick 5 numbers (1-30) or if they would like to choose EZ Pick where the computer randomly picks their 5 numbers at a cost of $1.00. Then you will give them a chance to also play the Next Chance drawing for an extra $1.00. They do not choose additional numbers for the Next Chance drawing. Once they have all of their selections complete, have the computer game generate the five random winning numbers and if they opted for the Next Chance drawing, select 4 more random numbers. Display all of the users numbers, all of the winning numbers, and display how much, if any, that the player has won based on the following information:
Answer:
Explanation:
The following code is written in Python and creates arrays for the user's numbers and the next chance numbers, it also creates a cost variable and a did_you_win variable. The function takes in the winning numbers as an array parameter. It asks all the necessary questions to generate data for all the variables and then compares the user's numbers to the winning numbers in order to detect if the user has won. Finally, it prints all the necessary information.
import random
def lottery(winning_numbers):
user_numbers = []
next_chance_drawing = []
cost = 0
did_you_win = "No"
#print("Would you like to choose your own 5 numbers? Y or N")
answer = input("Would you like to choose your own 5 numbers? Y or N: ")
if answer.capitalize() == "Y":
for x in range(5):
user_numbers.append(input("Enter number " + str(x+1) + ": "))
else:
for x in range(5):
user_numbers.append(random.randint(0,31))
cost += 1
next_chance = input("Would you like to enter a Next Chance drawing for $1.00? Y or N: ")
if next_chance.capitalize() == "Y":
for x in range(4):
next_chance_drawing.append(random.randint(0, 31))
cost += 1
if user_numbers == winning_numbers or next_chance_drawing == winning_numbers:
did_you_win = "Yes"
print("User Numbers: " + str(user_numbers))
print("Next Chance Numbers: " + str(next_chance_drawing))
print("Cost: $" + str(cost))
print("Did you win: " + did_you_win)
You are a computer consultant called in to a manufacturing plant. The plant engineer needs a system to control their assembly line that includes robotic arms and conveyors. Many sensors are used and precise timing is required to manufacture the product. Of the following choices, which OS would you recommend to be used on the computing system that controls the assembly line and why
Answer:
Linux operating system is suitable for the operation of the automated system because it is more secure with a free open-source codebase to acquire and create new applications on the platform.
Explanation:
Linux operating system is open-source software for managing the applications and network functionalities of a computer system and its networks. It has a general public license and its code is available to users to upgrade and share with other users.
The OS allows user to configure their system however they chose to and provides a sense of security based on user privacy.
Carly’s Catering provides meals for parties and special events. Write a program that prompts the user for the number of guests attending an event and then computes the total price, which is $35 per person. Display the company motto with the border that you created in the CarlysMotto2 class in Chapter 1, and then display the number of guests, price per guest, and total price. Also display a message that indicates true or false depending on whether the job is classified as a large event—an event with 50 or more guests. Save the file as CarlysEventPrice.java.
Answer:
Answered below
Explanation:
Scanner n = new Scanner(System.in);
System.out.print("Enter number of guests: ");
int numOfGuests = n.nextline();
double pricePerGuest = 35.0;
double totalAmount = numOfGuests * pricePerGuest;
String event = " ";
if ( numOfGuests >= 50){
event = "Large event";
}else{
event = "small event";
}
System.out.print(numOfGuests);
System.out.println(pricePerGuest);
System.out.println( totalAmount);
System.out.println(event);
A LAN Uses category 6 cabling. An issue with the connection results in network link to get degeneration and Only one device can communicate at a time. What is the connection operating at?
Half duplex
Simplex
Partial
Full Duplex
Answer:
partial
Explanation:
Consider a disk that rotates at 3600 rpm. The seek time to move the head between adjacent tracks is 2 ms. There are 32 sectors per track, which are stored in linear order from sector 0 through sector 31. The head sees the sectors in ascending order. Assume the read/write head is positioned at the start of sector 1 on track 8. There is a main memory buffer large enough to hold an entire track. Data is transferred between disk locations by reading from the source track into the main memory buffer and then writing the data from the buffer to the target track. a. How long will it take to transfer sector 1 on track 8 to sector 1 on track 9
Answer:
19.71 ms
Explanation:
The disk rotates at 3600 rpm, hence the time for one revolution = 60 / 3600 rpm = 16.67 ms.
Hence time to read or write on a sector = time for one revolution / number of sectors per track = 16.67 ms / 32 sectors = 0.52 ms
Head movement time from track 8 to track 9 = seek time = 2 ms
rotation time to head up sector 1 on track 8 to sector 1 on track 9 = 16.67 * 31/32 = 16.15 ms
The total time = sector read time +head movement time + rotational delay + sector write time = 0.52 ms + 2 ms + 16.15 ms + 0.52 ms = 19.19 ms
It will take 19.19 ms to transfer sector 1 on track 8 to sector 1 on track 9
The given parameters are:
[tex]d_r = 3600 rpm[/tex] --- the disk rotation
[tex]s=32[/tex] --- the sectors in a track
Calculate the time (t) to complete one revolution
[tex]t = \frac{60}{d_r}[/tex]
[tex]t = \frac{60}{3600}[/tex]
[tex]t = \frac{1}{6}[/tex]
So, the time to read/write to a sector is:
[tex]T = \frac{t}{s}[/tex]
This gives
[tex]T = \frac{1/6}{32}[/tex]
[tex]T = \frac{1}{192}[/tex]
Convert to ms
[tex]T = \frac{100}{192}[/tex]
[tex]T = 0.52ms[/tex]
Next, calculate the rotation time to head up sector 1 on track 8 to sector 1 on track 9
This is calculated as:
[tex]r_t = t \times \frac{s-1}{s}[/tex]
So, we have:
[tex]r_t = \frac 16 \times \frac{32-1}{32}[/tex]
[tex]r_t = \frac 16 \times \frac{31}{32}[/tex]
[tex]r_t = 0.1615[/tex]
Convert to ms
[tex]r_t = 0.1615 \times 100[/tex]
[tex]r_t = 16.15[/tex]
So, the required time to transfer sectors is:
Time = 2 * Time to read/write to a sector + Seek time + Rotation time
This gives
[tex]Time = 2 \times 0.52 + 2 + 16.15[/tex]
[tex]Time = 19.19[/tex]
Hence, it will take 19.19 ms to transfer sector 1 on track 8 to sector 1 on track 9
Read more about disk rotation at:
https://brainly.com/question/8139268
Implement the function charCnt. charCnt is passed in a name of a file and a single character (type char). This function should open the file, count the number of times the character is found within the file, close the file, and then return the count. If the file does not exist, this function should output an error message and then call the exit function to exit the program with an error value of 1.
Answer:
Answered below
Explanation:
//Program is written in Python programming language
def charCnt( fileName, char){
if not fileName.exists( ):
return sys.exit(1)
else:
openFile = open("$fileName.txt", "r")
readFile = openFile.read( )
fileLength = len (readFile)
count = 0
for character in range(fileLength):
if readFile[character] == char:
count++
openFile.close( )
return count
}
Assume hosts A and B are each connected to a switch Svia 100-Mbps links. The propagation delay on each link is 25μs. The switch Sis a store-and-forward device and it requires a delay of 35μs to process a packet after is has received the last bit in the packet. Calculate the total time required to transmit 40,000 bits from Ato B in the following scenarios. (The total time is measured from the start of the transmission of the first bit at A, until the last bit is received at B. We always assume that links are bi-directional with the same transmission rate and propagation delay in each direction unless specifically instructed otherwise.)
Answer:
885 μs
Explanation:
Given that:
Switch via = 100 Mbps links
The propagation delay for each link = 25μs.
Retransmitting a received packet = 35μs
To determine:
The total time required to transmit 40,000 bits from A to B.
Considering the fact as a single packet:
Transmit Delay / link = size/bandwith
= 4×10⁴ bits / 100 × 10⁶ bits/sec
= 400 μs
The total transmission time = ( 2 × 400 + 2 × 25 + 35) μs
= (800 + 50 + 35) μs
= 885 μs
Write a java program named BMI.java(i)print out your name and your pantherID(ii) Ask user to type in his/her weight and height; if an illegal input (such as a letter) is typed by the user, give the user one more chance to input correctly.(iii)Create a method to compute the body mass index (BMI) accordingly. BMI
Answer:
Answered below
Explanation:
//Print name and ID
Scanner x = new Scanner(System.in);
System.out.print("Enter name");
String name = x.nextline();
Scanner y = new Scanner(System.in);
System.out.print("Enter ID");
int id = y.nextline();
System.out.println(name, id);
Scanner w = new Scanner(System.in);
System.out.print("enter weight");
double weight = w.nextline();
Scanner h = new Scanner(System.in);
System.out.print("enter height: ");
double height = h.nextline();
int i = 0;
while( I < 2){
if ( !isDigit(weight) && !isDigit(height){
Scanner w = new Scanner(System.in);
System.out.print("enter weight:);
weight = w.nextline();
Scanner h = new Scanner(System.in);
System.out.print("enter height");
height = h.nextline();
}else{
break;
double BMI = weight / ( height **2)
System.out.print(BMI)}
I++
}
1.21 LAB: Divide by x
Write a program using integers user_num and x as input, and output user_num divided by x three times.
Answer:
Explanation:
The following code is written in Python. It is a function called divide_by_x and takes the user inputs as described. It then raises x to the third power and divides user_num by that number. This gives the same result as user_num divided by x three times. The answer is saved in the variable answer which is then returned to the user.
def divide_by_x(user_num, x):
answer = user_num / (x**3)
return answer
The program is an illustration of the division arithmetic operation.
The program in Python, where comments are used to explain each line is as follows:
#This gets input for user_num
user_num = int(input())
#This gets input for x
x = int(input())
This loop is repeated three times
for i in range(1,4):
#This divides user_num by x, each time
user_num /= x
#This prints the required output
print(user_num)
At the end of the program, user_num is divided three times by x and then printed.
Read more about similar programs at:
https://brainly.com/question/17277570
If an excel column will contain prices of smartphones, which number format should you uss
Answer:
You can use number formats to change the appearance of numbers, including dates and times, without changing the actual number. The number format does not affect the cell value that Excel uses to perform calculations. The actual value is displayed in the formula bar. Excel provides several built-in number formats.
Explanation:
Draw TOUT Uw Use the space below to draw your own image with the shapes. Then see if you can communicate it to your partner to draw using the shape drawing tool in Game Lab. You can also give your drawing to another group to use as a challenge 0 50 100 150 200 250 300 350 400 Shape Size These shapes are the correct size 50 100 Pattern Reference If you don't have red, green, or blue to draw with fill in the patterns or colors you'll use instead 150 200 Red 250 Green 300
Answer:
um
Explanation:
Write a method that evaluates to true or false depending on whether a box completely fits inside another:
public boolean nests( Box outsideBox )
This is potentially a difficult method, since the box may fit or not fit depending on how it is rotated. To simplify the method, write it so that it returns true if the two boxes nest without considering rotations (so height is compared to height, length compared to length, and so on.)
Answer:
box outside box
Explanation:
It is used to display a window with many options, or buttons, in Easy GUI. It can be used in situations when it is necessary to determine which option is the first selection because it returns 1 for buttons with index 0 and 0 for buttons with other indexes.
What public boolean nests contain box outside box?One of the built-in data types in Python is the Boolean type. It serves as a representation of an expression's truth value. For instance, the statement 0 == 1 is False while the statement 1 = 2 is True.
To write effective Python code, one must have a solid understanding of how Python's Boolean values operate.
A boolean value describes the checked attribute. Whenever it is present, it indicates that a checkbox next to an input> element should be selected (checked) before the page loads.
Therefore, The checked attribute can be applied to both checkbox and radio input types. Additionally, JavaScript can be used to modify the checked attribute after the page has loaded.
Learn more about boolean nests here:
https://brainly.com/question/28660200
#SPJ5
In what way can an employee demonstrate commitment?
Answer:
Come to work on time ready to work. Always work above and beyond. ... Come to work on time, follow all rules, do not talk about people, and be positive get along with coworkers.
Explanation:
An employee can demonstrate commitment to their job and organization in several ways.
First and foremost, they show dedication and enthusiasm by consistently meeting deadlines, going above and beyond to achieve goals, and taking ownership of their responsibilities.
Being punctual and reliable also reflects commitment. Employees who actively participate in team efforts, support colleagues, and offer innovative ideas exhibit their dedication to the company's success.
Demonstrating a willingness to learn and grow by seeking additional training or taking on new challenges further showcases commitment.
Ultimately, a committed employee is driven by a genuine passion for their work, a strong work ethic, and a sense of loyalty to their organization's mission and values.
Know more about employee commitment:
https://brainly.com/question/34152205
#SPJ6
The cafeteria offers a discount card for sale that entitles you, during a certain period, to a free meal whenever you have bought a given number of meals at the regular price. The exact details of the offer change from time to time. Describe an algorithm that lets you determine whether a particular offer is a good buy. What other inputs do you need
Answer:
Explanation:
The algorithm can be described as follows
The first process is to ensure that the constraints for the time at which the offers begin is well defined.
TIME1 = 14:00
TIME2 = 16:00
TIME3 = 18:00
Then, decide the final number of meal following the free meal that has been offered.
NUMBER_OF_MEALS=4;
Then; decide the prices attached to the meal at regular times.
PRICE = 200;
At regular mode, decide the prices attached to the meal and as well as when the offer time commences.
PRICE_OFFER = 160;
Then ask the client(i.e the user) to put in the value required for the number of meals they desire to order.
Input values in n
Suppose (the value exceeds 8)
Then proceed to enquire from the client if they wish to go for the offer.
If not, use the regular price for the order.
Assume the client asks if the offer is a good one to bid for.
You are to show then the analysis of the calculation.
regular = 8 × PRICE
offer = 8 × PRICE_OFFER
profit = regular - offer
Finally, show the profit to the client which will let them know if it is good to bid for it or not.
Consider the following incomplete method, which is intended to return the longest string in the string array words. Assume that the array contains at least one element.
public static String longestWord(String[] words)
{
/* missing declaration and initialization */
for (int k = 1; k < words.length; k++)
{
if (words[k].length() > longest.length())
{
longest = words[k];
}
}
return longest;
}
Which of the following can replace /* missing declaration and initialization */ so that the method will work as intended?
a. int longest = 0;
b. int longest = words[0].length();
c. String longest = "";
d. String longest = words[0];
e. String longest = words[1];
Answer:
String longest = "";
Explanation:
The initialization that would allow the method to work as intended would be the following
String longest = "";
This is because the method is looping through the array provided as an argument and comparing each word in the array with the word saved inside the variable called longest. The length of both are compared and if the word in the array is longer than the string saved in the variable longest then it is overwritten with the word in the array.
what if an html code became cracked and formed a bug how can i repair that