This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width.
(1) Modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (1 pt)
(2) Modify the given program to use a loop to output an arrow base of width arrowBaseWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow base. (1 pt)
(3) Modify the given program to use a loop to output an arrow head of width arrowHeadWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow head. (2 pts)
(4) Modify the given program to only accept an arrow head width that is larger than the arrow base width. Use a loop to continue prompting the user for an arrow head width until the value is larger than the arrow base width. (1 pt)
while (arrowHeadWidth <= arrowBaseWidth) {
// Prompt user for a valid arrow head value
}
Example output for arrowBaseHeight = 5, arrowBaseWidth = 2, and arrowHeadWidth = 4:
Enter arrow base height:
5
Enter arrow base width:
2
Enter arrow head width:
4

**
**
**
**
**
****
***
**
*
This is what I have:
import java.util.Scanner;
public class DrawHalfArrow
{
public static void main(String[] args)
{
Scanner scnr = new Scanner(System.in);
int arrowBaseHeight = 0;
int arrowBaseWidth = 0;
int arrowHeadWidth = 0;
System.out.println("Enter arrow base height:");
arrowBaseHeight = scnr.nextInt();
System.out.println("Enter arrow base width:");
arrowBaseWidth = scnr.nextInt();
while (arrowHeadWidth >= arrowBaseWidth)
{
System.out.println("Enter arrow head width:");
arrowHeadWidth = scnr.nextInt();
}
// Draw arrow base (height = 3, width = 2)
for(int i=0; i < arrowBaseHeight; ++i)
{
for(int j=0; j < arrowBaseWidth; ++j)
{
System.out.print("*");
}
System.out.println();
}
// Draw arrow head (width = 4)
for(int i=0; i < arrowHeadWidth; ++i)
{
for(int j=0; j < arrowHeadWidth-i; ++j)
{
System.out.print("*");
}
System.out.println();
}
return;
}
}

Answers

Answer 1

Answer:

The modified program in Java is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

 int arrowHeadWidth, arrowBaseWidth, arrowBaseHeight;

 System.out.print("Head Width: "); arrowHeadWidth = input.nextInt();

 System.out.print("Base Width: "); arrowBaseWidth = input.nextInt();

 System.out.print("Base Height: "); arrowBaseHeight = input.nextInt();

 while (arrowHeadWidth <= arrowBaseWidth) {

       System.out.print("Head Width: "); arrowHeadWidth = input.nextInt();

 System.out.print("Base Width: "); arrowBaseWidth = input.nextInt();      }

 for(int i = 0; i<arrowBaseHeight; i++){

     for(int j = 0; j<arrowBaseWidth;j++){

         System.out.print("*");        }

         System.out.println();    }

 for(int i = arrowHeadWidth; i>0;i--){

     for(int j = 0; j<i;j++){

         System.out.print("*");        }

         System.out.println();    }

}

}

Explanation:

This declares the arrow dimensions

 int arrowHeadWidth, arrowBaseWidth, arrowBaseHeight;

This get input for the head width

 System.out.print("Head Width: "); arrowHeadWidth = input.nextInt();

This get input for the base width

 System.out.print("Base Width: "); arrowBaseWidth = input.nextInt();

This get input for the base height

 System.out.print("Base Height: "); arrowBaseHeight = input.nextInt();

This loop is repeated until the head width is greater than the base width

 while (arrowHeadWidth <= arrowBaseWidth) {

       System.out.print("Head Width: "); arrowHeadWidth = input.nextInt();

 System.out.print("Base Width: "); arrowBaseWidth = input.nextInt();      }

This iterates through the base height

 for(int i = 0; i<arrowBaseHeight; i++){

This iterates through the base width

     for(int j = 0; j<arrowBaseWidth;j++){

This fills the base

         System.out.print("*");        }

This prints a new line

         System.out.println();    }

These iterate through the arrow head

 for(int i = arrowHeadWidth; i>0;i--){

     for(int j = 0; j<i;j++){

This fills the arrow head

         System.out.print("*");        }

This prints a new line

         System.out.println();    }


Related Questions

what is 5 times 5 times 16 times 11 2345

Answers

Answer:

4,400.

Explanation:

In order to determine what is 5 times 5 times 16 times 11 the following calcularion has to be done:

((11 x 16) x 5) x 5 = X

(176 x 5) x 5 = X

880 x 5 = X

4,400 = X

Therefore, 5 times 5 times 16 times 11 is equal to 4,400.

Answer:

use a cucullated

Explanation:

Consider the following class definition.
public class Example {
private int x;
// Constructor not shown.
}
Which of the following is a correct header for a method of the Example class that would return the value of the private instance variable x so that it can be used in a class other than Example ?
private int getX()
private void getX()
public int getX()
public void getX()
public void getX(int x)

Answers

Answer:

public int getX()

Explanation:

From the question, we understand that the value is to be accessed in other classes.

This implies that we make use of the public access modifier. Using the public modifier will let the instance variable be accessed from other classes.

Also, we understand the return type must be the variable type of x. x is defined as integer. So, the constructor becomes public x

Lastly, we include the constructor name; i.e. getX().

Hence, the constructor is: public int getX()

Which of the following examples can be solved with unsupervised learning?

Group of answer choices

A list of tweets to be classified based on their sentiment, the data has tweets associated with a positive or negative sentiment.

A spam recognition system that marks incoming emails as spam, the data has emails marked as spam and not spam.

Segmentation of students in ‘Technical Aspects of Big Data’ course based on activities they complete. The training data has no labels.

Answers

Answer:

Explanation:

Segmentation of students in ‘Technical Aspects of Big Data’ course based on activities they complete. The training data has no labels.

What is the meaning of negative impact in technology

Answers

Answer:

the use of criminal thought by the name of education

Write a function:
class Solution { public int solution (int) A); }
that, given a zero-indexed array A consisting of N integers representing the initial test scores of a row of students, returns an array of integers representing their final test scores in the same order).
There is a group of students sat next to each other in a row. Each day, students study together and take a test at the end of the day. Test scores for a given student can only change once per day as follows:
• If a student sits immediately between two students with better scores, that student's score will improve by 1 when they take the test.
• If a student sits between two students with worse scores, that student's test score will decrease by 1.
This process will repeat each day as long as at least one student keeps changing their score. Note that the first and last student in the row never change their scores as they never sit between two students.
Return an array representing the final test scores for each student once their scores fully stop changing. Test Ou
Example 1:
Input: (1,6,3,4,3,5]
Returns: (1,4,4,4,4,5]
On the first day, the second student's score will decrease, the third student's score will increase, the fourth student's score will decrease by 1 and the fifth student's score will increase by 1, i.e. (1,5,4,3,4,5). On the second day, the second student's score will decrease again and the fourth student's score will increase, i.e. (1,4,4,4,4,5). There will be no more changes in scores after that.

Answers

Answer:

what are the choices

:"

Explanation:

What is a geam in the ggplot2 system?
a) a plotting object like point, line, or other shape
b) a method for making conditioning plots
c) a method for mapping data to attributes like color and size
d) a statistical transformation

Answers

Answer:

a) a plotting object like point, line, or other shape

Explanation:

A geom in the ggplot2 system is "a plotting object like point, line, or other shape."

A Geom is used in formulating different layouts, shapes, or forms of a ggplot2 such as bar charts, scatterplots, and line diagrams.

For example some different types of Geom can be represented as geom_bar(), geom_point(), geom_line() etc.

Internal monitoring is accomplished by inventorying network devices and channels, IT infrastructure and applications, and information security infrastructure elements. Group of answer choices True False

Answers

Answer:

True

Explanation:

It is TRUE that Internal monitoring is accomplished by inventorying network devices and channels, IT infrastructure and applications, and information security infrastructure elements.

The above statement is true because Internal Monitoring is a term used in defining the process of creating and disseminating the current situation of the organization’s networks, information systems, and information security defenses.

The process of Internal Monitoring involved recording and informing the company's personnel from top to bottom on the issue relating to the company's security, specifically on issues about system parts that deal with the external network.

1.Siguraduhing _______ang mga datos o impormasyong

2.Isaalang- alang ang partikular na _______ o lokasyon ng pinagmulan ng impormasyon

3.Upang matiyak na hindi ______ang mga impormasyon, maaaring magsaliksik at kilalaning mabuti ang awtor at ang kanyang mga artikulo​

Answers

Answer:

1.maayos

2. Lugar

3. mali

Explanation:

im correct if I'm rwong :-)

A capacitor of capacitance 102/π µF is connected across a 220 V, 50 Hz A.C. mains. Calculate the capacitive reactance, RMS value of current and write down the equations of voltage and current.

Answers

Answer:

The capacitive reactance will be "100Ω" and RMS value of current is "2.2 A". A further explanation is provided below.

Explanation:

Given:

[tex]C =\frac{10^2}{\pi}\times 10^{-6} \ F[/tex]

[tex]V_{RMS}=220 \ V[/tex]

[tex]f = 50 \ Hz[/tex]

Now,

The capacitive reactance will be:

⇒ [tex]X_c=\frac{1}{\omega C} =\frac{1}{2 \pi f C}[/tex]

                   [tex]=\frac{1}{2\times \pi\times 50\times \frac{10^{-4}}{\pi} }[/tex]

                   [tex]=100 \ \Omega[/tex]

RMS value of current will be:

⇒ [tex]I_{RMS}=\frac{V_{RMS}}{X_c}[/tex]

             [tex]=\frac{220}{100}[/tex]

             [tex]=2.2 \ A[/tex]

So that,

⇒ [tex]V_m=220\times \sqrt{2}[/tex]

         [tex]=311 \ V[/tex]

⇒ [tex]I_m=2.2\times \sqrt{2}[/tex]

         [tex]=3.1 \ A[/tex]

hence,

The equation will be:

⇒ [tex]\nu=311 sin31 \ 4t[/tex]

and,

⇒ [tex]i=3.1 sin(314t+\frac{\pi}{2} )[/tex]

whatis a node (or a device) that connects two different networks together and allows them to communicate.

Answers

Answer:

Router

Explanation:

A router can be defined as a network device that is designed typically for forwarding data packets between two or more networks based on a well-defined routing protocol.

Hence, a router is a node (or a device) that connects two different networks together and allows them to communicate.

Generally, routers are configured using a standard routing protocol with an IP address as the default gateway.

A routing protocol can be defined as a set of defined rules or algorithms used by routers to determine the communication paths unto which data should be exchanged between the source router and destination or host device.

Additionally, in order for packets to be sent to a remote destination, these three parameters must be configured on a host.

I. Default gateway

II. IP address

III. Subnet mask

After a router successfully determines the destination network, the router checks the routing table for the resulting destination network number. If a match is found, the interface associated with the network number receives the packets. Else, the default gateway configured is used. Also, If there is no default gateway, the packet is dropped.

javascript Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each month.

Answers

Answer:

Explanation:

The following code is written in Javascript as requested and creates a function that takes in the total credit card debt amount and the minimum monthly payment. Then it calculates the new balance at the end of the year after paying 12 monthly minimum payments. Finally, printing out the new balance to the console which can be seen in the attached picture below.

let brainly = (debt, minimum) => {

   debt = debt - (minimum * 12);

   console.log("Credit Card Balance after one year: $" + debt);

}

brainly(50000, 3400);

Write a program whose input is two integers. Output the first integer and subsequent increments of 5 as long as the value is less than or equal to the second integer. Ex: If the input is: - 15 10 the output is: -15 -10 -5 0 5 10 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last. 5.17 LAB: Print string in reverse Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text. Ex: If the input is: Hello there Hey done then the output is: ereht olleh уен 275344.1613222

Answers

Answer:

Following are the code to the given question:

For code 1:

start = int(input())#defining a start variable that takes input from the user end

end = int(input())#defining a end variable that takes input from the user end

if start > end:#use if that checks start value greater than end value

   print("Second integer can't be less than the first.")#print message

else:#defining else block

   while start <= end:#defining a while loop that checks start value less than equal to end value

       print(start, end=' ')#print input value

       start += 5#incrementing the start value by 5

   print()#use print for space

For code 2:

while True:#defining a while loop that runs when its true

   data = input()#defining a data variable that inputs values

   if data == 'Done' or data == 'done' or data == 'd':#defining if block that checks data value

       break#use break keyword

   rev = ''#defining a string variable rev

   for ch in data:#defining a for loop that adds value in string variable  

       rev = ch + rev#adding value in rev variable

   print(rev)#print rev value

Explanation:

In the first code two-variable "first and end" is declared that takes input from the user end. After inputting the value if a block is used that checks start value greater than end value and use the print method that prints message.

In the else block a while loop is declared that checks start value less than equal to end value and inside the loop it prints input value and increments the start value by 5.

In the second code, a while loop runs when it's true and defines a data variable that inputs values. In the if block is used that checks data value and use break keyword.

In the next step, "rev" as a string variable is declared that uses the for loop that adds value in its variable and prints its values.

use terms of interection model and norman model for ATM?

Answers

Answer:

ther you are

Explanation:

. HCI Technology Application in ATMHuman computer interface (HCI) is a term used todescribe the interaction between users and computer-s; in other words, the method by which a user tellsthe computer what to do, and the responses which thecomputer makes. Even more, HCI is about designingcomputer systems to support people’s use, so that theycan carry out their activities productively and safely.All of this can be summarized as ”to develop or im-prove the safety, utility, effectiveness, efficiency andusability of systems that include computers” [1].

MAKE ME BRAINLIEST PLEASE I NEED IT TO PASS AMBITIOS STAGE ON HERE THANKS

Writing of a program to take two integer and print sum and product of them.
Take two integer input from user and first calculate the sum of the two and then product of the two.
Take two double input for length and breadth of a rectangle and print area type casted to integer.
Take side of a square from user and print area and perimeter of it.

Answers

Answer:

1.)

def two(a, b) :

print(a+b)

print(a*b)

2.)

a = int(input('enter an integer values '))

b = int(input('Enter another integer value' ))

print(a+b)

print(a*b)

3.)

Take side of a square from user and print area and perimeter of it.

def square(a):

area = a**2

perimeter = 4*a

print(area, perimeter)

Explanation:

Code written in python :

The first function named two, takes to arguments a and b ;

The sum of integers a and b is taken and displayed using ; print(a+b)

The product of integers a and b is taken and displayed using ; print(a*b)

2.)

User can enter an input and converted to an integer value using the command ;

int(input()) ; the sum and product of these values are displayed using :

print(a*b) and print(a+b)

The Area and perimeter of a square requires the side length, which is taken as the argument a in the square function defined.

Area of square = a² = a**2

Perimeter = 4 * a

some machine/items/gadget having only hardware​

Answers

Yeh it’s becoz they work with hardware that’s why

Write a program that reads the balance and annual percentage interest rate and displays the interest for the next month. Python not JAVA

Answers

Answer:

Explanation:

The following code is written in Python. It asks the user to enter the current balance and the annual interest rate. It then calculates the monthly interest rate and uses that to detect the interest that will be earned for the next month. Finally, printing that to the screen. A test output can be seen in the attached picture below.

balance = int(input("Enter current Balance: "))

interest = int(input("Enter current annual interest %: "))

interest = (interest / 12) / 100

next_month_interest = balance * interest

print('$ ' + str(next_month_interest))

TP1. लेखा अभिलेखको अर्थ उल्लेख गर्नुहोस् । (State the mea
TP2. लेखाविधिलाई परिभाषित गर्नुहोस् । (Define accounting.
TP 3. लेखाविधिको कुनै तीन महत्वपूर्ण उद्देश्यहरू लेख्नुहोस्
accounting.)​

Answers

Explanation:

TP1. लेखा अभिलेख भनेको ज्ञानको त्यस्तो शाखा हो, जुन व्यवसायको आर्थिक कारोबारहरूलाई नियमित, सु-व्यवस्थित र क्रमबद तरिकाले विभिन्न पुस्तिकाहरूमा अभिलेख गर्ने कार्यसँग सम्बन्धित छ।

How do you find the average length of words in a sentence with Python?

Answers

Answer:

split() wordCount = len(words) # start with zero characters ch = 0 for word in words: # add up characters ch += len(word) avg = ch / wordCount if avg == 1: print "In the sentence ", s , ", the average word length is", avg, "letter." else: print "In the sentence ", s , ", the average word length is", avg, "letters.

Write an application that inputs a five digit integer (The number must be entered only as ONE input) and separates the number into its individual digits using MOD, and prints the digits separated from one another. Your code will do INPUT VALIDATION and warn the user to enter the correct number of digits and let the user run your code as many times as they want (LOOP). Submit two different versions: Using the Scanner class (file name: ScanP2)

Answers

Answer:

The program in Java is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

 int n, num;

 Scanner input = new Scanner(System.in);

 System.out.print("Number of inputs: ");

 n = input.nextInt();

 LinkedList<Integer> myList = new LinkedList<Integer>();

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

     System.out.print("Input Integer: ");

     num = input.nextInt();

     while (num > 0) {

     myList.push( num % 10 );

     num/=10;

     }

     while (!myList.isEmpty()) {

         System.out.print(myList.pop()+" ");

     }

     System.out.println();

     myList.clear();

 }

}

}

Explanation:

This declares the number of inputs (n) and each input (num) as integer

 int n, num;

 Scanner input = new Scanner(System.in);

Prompt for number of inputs

 System.out.print("Number of inputs: ");   n = input.nextInt();

The program uses linkedlist to store individual digits. This declares the linkedlist

 LinkedList<Integer> myList = new LinkedList<Integer>();

This iterates through n

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

Prompt for input

     System.out.print("Input Integer: ");

This gets input for each iteration

     num = input.nextInt();

This while loop is repeated until the digits are completely split

     while (num > 0) {

This adds each digit to the linked list

     myList.push( num % 10 );

This gets the other digits

     num/=10;

     }

The inner while loop ends here

This iterates through the linked list

     while (!myList.isEmpty()) {

This pops out every element of thelist

         System.out.print(myList.pop()+" ");

     }

Print a new line

     System.out.println();

This clears the stack

     myList.clear();

 }

move down one screen​

Answers

Answer:

k(kkkkkkkkkkklkkkkkkkkkk(

okay , I will


step by step explanation:

Which of the following are incident priorities?

Answers

Answer:

what are the options?

reply in comment so i can help:)

Nested loops: Print rectangle Given the number of rows and the number of columns, write nested loops to print a rectangle. Sample output with inputs: 23 * * * 1 num_rows = int(input) 2 num_cols = int(input) 1 test passed VOUAWNP " Your solution goes here" print('*', end='') print All tests passed Run CHALLENGE ACTIVITY 5.8.2: Nested loops: Print seats. Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print a space after each seat. Sample output with inputs: 23 1A 1B 1C 2A 2B 2C 1 num_rows = int(input) 2 num_cols = int(input) 1 test passed # Note 1: You will need to declare more variables 5 # Note 2: Place end=' ' at the end of your print statement to separate seats by spaces 7" Your solution goes here" All tests passed 9 print Run

Answers

Answer:

See attachment

Explanation:

The solution and the explanation could not be submitted directly. So,I added both as attachments

To print a rectangle based on the given number of rows and columns, you will use nested loops using the following code:

num_rows = int(input())

num_cols = int(input())

for i in range(num_rows):

   for j in range(num_cols):

       print('*', end=' ')

   print()

How can I print a rectangle using nested loops?

By using nested loops, you will iterate through each row and column to print the desired shape. The outer loop controls the rows while the inner loop controls the columns. Within the inner loop, the desired symbol or character, such as "*", is printed with the print() statement.

The end=' ' parameter is used to separate each character by a space. The outer loop then moves to the next row and the process continues until the desired number of rows and columns are printed forming a rectangle.

Read more about nested loops

brainly.com/question/31921749

#SPJ6

As a CISO, you are responsible for developing an information security program based on using a supporting framework. Discuss what you see as some major components of an information security program.

Answers

Answer:

The CISO (Chief Information Security Officer) of an organization should understand the following components of an information security program:

1) Every organization needs a well-documented information security policy that will govern the activities of all persons involved with Information Technology.

2) The organization's assets must be classified and controlled with the best industry practices, procedures, and processes put in place to achieve the organization's IT objectives.

3) There should be proper security screening of all persons in the organization, all hardware infrastructure, and software programs for the organization and those brought in by staff.

4) Access to IT infrastructure must be controlled to ensure compliance with laid-down policies.

Explanation:

As the Chief Information Security Officer responsible for the information and data security of my organization, I will work to ensure that awareness is created of current and developing security threats at all times.  I will develop, procure, and install security architecture, including IT and network infrastructure with the best security features.  There will good management of persons' identity and controlled access to IT hardware.  Programs will be implemented to mitigate IT-related risks with due-diligence investigations, and smooth governance policies.

Unlike the collapse of Enron and WorldCom, TJX did not break any laws. It was simply not compliant with stated payment card processing guidelines.
a) true
b) false

Answers

I think the answer is A) true

The statement "Unlike the collapse of Enron and WorldCom, TJX did not break any laws. It was simply not compliant with stated payment card processing guidelines" is definitely true.

What was the cause of the TJX data breach?

The major cause of the TJX data breach was thought to be the hack that wasn't discovered until 2007, hackers had first gained access to the TJX network in 2005 through a WiFi connection at a retail store.

These situations were eventually able to install a sniffer program that could recognize and capture sensitive cardholder data as it was transmitted over the company's networks. They should be required to change the encryption methodology of the data they are using to save the personal identification information of their customers.

Therefore, the statement "Unlike the collapse of Enron and WorldCom, TJX did not break any laws. It was simply not compliant with stated payment card processing guidelines" is definitely true.

To learn more about, TJX data, refer to the link:

https://brainly.com/question/22516325

#SPJ2

Use strlen(userStr) to allocate exactly enough memory for newStr to hold the string in userStr (Hint: do NOT just allocate a size of 100 chars).
#include
#include
#include
int main(void) {
char userStr[100] = "";
char* newStr = NULL;
strcpy(userStr, "Hello friend!");
/* Your solution goes here */
strcpy(newStr, userStr);
printf("%s\n", newStr);
return 0;
}

Answers

Answer:

Following are the complete code to the given question:

#include <stdio.h>//header file

#include <string.h>//header file

#include <stdlib.h>//header file

int main()//main method  

{

  char userStr[100] = "";//defining a char array  

  char* newStr = NULL;//defining a char pointer  

  strcpy(userStr, "Hello friend!");//use strcpy method that holds char value  

  newStr = (char *)malloc(strlen(userStr));//defining a char variable that use malloc method

  strcpy(newStr, userStr);//use strcpy method that holds newStr and userStr value

  printf("%s\n", newStr);//print newStr value

  return 0;

}

Output:

Hello friend!

Explanation:

In this code inside the main method a char array "userStr" and a char type pointer variable "newStr" holds a value that is null, and inside this strcpy method is declared that holds value in the parameters.

In this, a malloc method is declared that uses the copy method to hold its value and print the newStr value.

Any help , and thank you all

Answers

Answer:

There are 28 chocolate-covered peanuts in 1 ounce (oz). Jay bought a 62 oz. jar of chocolate-covered peanuts.

Problem:

audio

How many chocolate-covered peanuts were there in the jar that Jay bought?

Enter your answer in the box.

Explanation:

Viết chương trình thực hiện các công việc sau(sử dụng con trỏ):
a. Nhập vào một mảng các số nguyên n (5<=n<=50) phần tử.
b. Ghi ra file văn bản Sochan.txt các số chẵn của mảng vừa nhập.
c. Đọc file Sochan.txt sắp xếp mảng số chẵn theo thứ tự giảm dần và in kết quả ra
màn hình .

Answers

Answer:

ahbtibrkn

Explanation:

uklbejixbi9538021#fbn

write c++ an algorithm to write a program to sort two numbers ascending or descending order​

Answers

Answer:

++ provides versions of these algorithms in the namespace std::ranges. Algorithms are the vast topic that covers topics from searching, sorting to min/max heaps. These can be categorized as:

Explanation of C++ Algorithm

Explanation:

JAVA CHALLENGE ZYBOOKs
ACTIVITY
2.18.3: Fixed range of random numbers.
Type two statements that use nextInt() to print 2 random integers between (and including) 100 and 149. End with a newline. Ex:
112 102
My Previous Incorrect Attempt :
import java.util.Scanner;
import java.util.Random;
public class RandomGenerateNumbers {
public static void main (String [] args) {
Random randGen = new Random();
int seedVal;
seedVal = 4;
randGen.setSeed(seedVal);
/* Your solution goes here */
int first = randGen.nextInt(10);
int second = randGen.nextInt(10);
System.out.println(first*seedVal*14);
System.out.println(second*seedVal*(51/4)+6);
}
}
MUST BE USED CODE TEMPLATE:
import java.util.Scanner;
import java.util.Random;
public class RandomGenerateNumbers {
public static void main (String [] args) {
Random randGen = new Random();
int seedVal;
seedVal = 4;
randGen.setSeed(seedVal);
/* Your solution goes here */
}
}

Answers

Answer:

Replace  /* Your solution goes here */ with:

System.out.println(randGen.nextInt(49) + 100);

System.out.println(randGen.nextInt(49) + 100);

Explanation:

Required

Statements to print two random numbers between 100 and 149 (both inclusive)

First, the random numbers must be generated. From the template given, the random object, randGen, has been created.

The syntax to then follow to generate between the interval is:

randGen.nextInt(high-low) + low;

Where:

high = 149 and low = 100

So, the statement becomes:

randGen.nextInt(149 - 100) + 100;

randGen.nextInt(49) + 100;

Lastly, print the statements:

System.out.println(randGen.nextInt(49) + 100);

System.out.println(randGen.nextInt(49) + 100);

Write a C++ program that displays the appropriate shipping charge based on the region code entered by the user. To be valid, the region code must contain exactly three characters: a letter (either A or B) followed by two numbers. The shipping charge for region A is $25. The shipping charge for region B is $30. Display an appropriate message if the region code is invalid. Use a sentinel value to end the program. Save and then run the program. Test the program using the following region codes: A11, B34, C7, D2A, A3N, C45, and 74TV.

Answers

Answer:

Following are the code to the given question:

#include <iostream>//header file

#include <string>//header file

using namespace std;

int main()//main method

{

string region;//defining a string variABLE

while(true)//defining a while loop for input value

{

cout << "Enter the region code(-1 to quit): ";//print message

cin >> region;//input string value

if(region == "-1")//defining  if to checks string value

{

break;//use break keyword

}

else//else block

{

if(region.length() != 3)//defining if to check string value length not equal to 3  {

cout<<"Invalid region code. Region code must contain exactly three characters."<<endl;//print message

}

else

{

if(region.at(0) == 'A' || region.at(0) == 'B')//defining at method that checks string value

{

if((region.at(1) >= '0' && region.at(1) <='9') && (region.at(2) >= '0' && region.at(2) <='9'))//defining at method that checks string value

{

if(region.at(0) == 'A')//defining at method that checks string value

{

cout<<"The shipping charge for region is $25."<<endl;//print message

}

else

{

cout<<"The shipping charge for region is $30."<<endl;//print message

}

}

else

{

cout<<"Invalid region code. Region code should start with A or B followed by two numbers."<<endl;//print message    

}

}

else

{

cout<<"Invalid region code. Region code should start with A or B."<<endl;//print message

}

}

}

}

return 0;

}

Output:

Please find the attached file.

Explanation:

In this code, inside the main method a string variable "region" is declared that use while loop to the input value and use the conditional statement that checks the input value and print the value as per the condition and print the value.

Other Questions
Answer to the question Guys pls help me!!!!!!!!! Macb.Speak,ifyou can. What are you?1. Witch. All hail, Macbeth! hail to thee, thane ofGlamis!2. Witch. All hail, Macbeth, hail to thee, thane ofCawdor!3. Witch. All hail, Macbeth, thou shalt be king hereafter!How does the witches' prophecy, that Macbeth will one day be king, changeMacbeth's character? factor the following(a+b)-18(a+b)-88 The surface of an air hockey table has a perimeter of 32 feet its area is 60 ft.what are the dimensions of the air hockey table Drag the tiles to the boxes to form correct pairs.Match each conservation effort with the resource it could directly help save.saving forestsconserving freshwater aquifersreducing CO2 emissions that contribute to climate changeWalk or use a bicycle for short-distancetravel.Use computers for communication andtaking notes.Treat sewage water and use it in factories. An analyst gathered the following information about a company: 01/01/04 - 50,000 shares issued and outstanding at the beginning of the year 04/01/04 - 5% stock dividend 10/01/04 - 10% stock dividend What is the company's weighted average number of shares outstanding at the end of 2004 BRAINLIEST!!!! Reread the beginning of this essay about a specific form of humor. Did you see that crane? As we walked through downtown Victoria, British Columbia, admiring the new scenery, my brother pointed off in the distance. The actual crane, not the construction crane. I craned my neck, peering into the distance to look for the thin white bird. Technically theyre both actual cranes. Its not like construction cranes are fake. Finally, I spotted it, pecking at the sandy beach to find its dinner, the tall buildings of the city silhouetted behind it. Far in the distance, there were construction cranes as well.What form of humor is the topic of the essay?1 irony2 parody3 puns4 vaudeville Why did the Soviet Union construct the Berlin Wall? A) To keep East Berliners in B) To keep West Berliners out. 5. If the lines 2x + 3ay 1 = 0 and 3x + 4y + 1 = 9 are mutually perpendicular, then the value of a is (1 Point) O a. O b.3 O-1/2 The private school enrolled 1050 new students last year and the number of students enrolled this year decreased to 798.What was the percentage decrease in the number of students enrolled? Help please !!!!!!!! What does Eric Schlosser say his book is primarily about in his Introduction toFast Food Nation?A. The number of animals killed each year in the fast-food industryB. The way fast food has shaped America and what it representsC. The history of fast food and how it came to be successfulD. The amount of money Americans spend on fast food in a year In an experiment to measure the temperature of a Bunsen burner flame, a 250 g piece of iron is held in the flame for several minutes until it reaches the same temperature as the flame . The hot metal is then quickly transferred to 285 g of water contained in a 40.0 g copper calorimeter at 15.0 oC. The final temperature of the copper and water is 80.0 oC.Using your answer from determine the temperature of the Bunsen flame. Drag each tile to the correct location.Decide whether each characteristic describes conditions in the North or the South at the end of the Civil War.NorthSouthsuffered huge losses in terms ofproperty, railroads, and manpowerled Reconstruction after thedeveloped the transcontinentalrailroad to boost Industrial growthCivil War had endedfaced economic failures thatmade its money and banks Choisissez toutes les rponses justes.Obtenir le bac estune mecheun grand vnement dans la vieun rite de passageune mairieune grande reussite HELP DUE IN 3 HOURSIf f(1)=10 and f(n)=-2f(n-1) then find the value of f(5) Which polymers contain nitrogen?A.starch B.glycogen C.cellulose D.chitin E.amylopectin An animal cell is dividing. Which of the following would not be seen during this process?cleavage furrowcytokinesiscell platecentrioles The manufacturer id number for proctor and gamble is (037000) and the item number for a box of bounce fabric softener is (80049). What is the valid upc? A- 0-37000-80049-9 B-0-37000-80049-1 C-1-37000-80049-1 D-1-80049-37000-0