(Count consonants and vowels) Write a program that prompts the user to enter a text in one line and displays the number of vowels and consonants in the text. Use a set to store the vowels A, E, I, O, and U. Sample

Answers

Answer 1

Answer:

The program to this question as follows:

Program:

s= input("Please Enter your String : ")#input value from user in String variable  

vowel= 0 #defining integer variable

consonant= 0 #defining integer variable

for i in s: #defining for loop for count vowel and consonant

   if(i == 'a' or i == 'e' or i == 'i' or i == 'o' or i == 'u'

   or i == 'A' or i == 'E' or i == 'I' or i == 'O' or i == 'U'): #if block that check vowels

       vowel = vowel + 1 #adding value in vowel variable

   else: # count consonant

       consonant = consonant + 1 #adding value in consonant variable

print("Number of Vowels: ", vowel) #print vowel

print("Number of Consonant: ", consonant) #print consonant

Output:

Please Enter your String : Database is a collection row and column

Number of Vowels:  14

Number of Consonant:  25

Explanation:

In the above python code three variable "s, vowel, and consonant" are defined, in which variable s is used to input a string value from the user end, and the "vowel and consonant" variable is used to count their values.

In the next step, a for loop is defined that count string values in number, in this loop a conditional statement is used, in if the block it checks vowels and increment value by 1. In the else block it count consonant value and uses print function to print both variable "vowel and consonant" value      

Related Questions

An interface is a class that contains only the method headings and each method heading is terminated with a semicolon. True False

Answers

Answer:

False

Explanation:

Interfaces are similar to classes in Java, but they are not a type of class. A class defines the attributes and behaviours of objects, while interface contains the methods that shows the behaviours to be implemented by a class.

A method is one or more group of statements, it does not need to end with a semicolon. Methods in interfaces are abstract and for a class to contain these abstract method, it must be defined in the class.

An interface is a class that contains only the method headings and each method heading is terminated with a semicolon is a true statement.

What is interface?

An interface is known to be a kind of reference that is seen in Java. It is same to look the same with class.

It is known as a series of abstract methods that shows the description of the work that a specific object can do. Here, An interface is a class that has  only the method headings and the method heading is ended with a semicolon.

Learn more about interface from

https://brainly.com/question/7282578

________ is the gathering, organizing, sharing, and analyzing of the data and information to which a business has access.

Answers

Answer:

"knowledge management"  is the answer for the above question.

Explanation:

Knowledge management is used to manage information. It is used to collect the data or information and analyze the information to extract the useful information.The useful information collected by this concept is used for the organization to take the decisions of the organizations.The above question asked about the concept which is used to gather the information and analyze the information for the business. This concept name is "Knowledge management".

Create detailed pseudocode for a program that calculates how many days are left until Christmas, when given as an input how many weeks are left until Christmas. Use variables named weeks and days.

Answers

Answer:

Following are the Pseudocode for the above problem:

Explanation:

Declare weeks and days As Variables Output: "Enter the input for weeks are left until Christmas."Set weeks = user answerSet days = weeks *7Output: “The days left until Christmas is ” Output: days.

Output:

If the user inputs 2 then the output is "The days left until Christmas is 14"If the user inputs 3 then the output is "The days left until Christmas is 21"

Pseudocode Explanation:

Pseudocode is the solution to any problem which is written in the form of the English language.The only difference between the algorithm and Pseudocode is that the algorithm is only written in English and the Pseudocode is written in the form of input and output.

List three types of technical information sources that an IS professional might use when researching a new storage technology and selecting specific products that incorporate that technology. Which information?

Answers

Answer:

The three types of technical information sources are:      

Vendor and manufacturer Web sites.

Technology-oriented Web sites and publications.

Professional society Web sites.              

Explanation:

Professional society Web sites provide most unbiased information.

These professional social websites are non profit companies as opposed to other sources of information that are profit making.

Social websites provides with the information that can help their members in a best way about getting information of their interest. This is done in an unbiased way because they do not work for some specific organizations or companies that want to sell their products or services.

What is a method whereby new problems are solved based on the solutions from similar cases solved in the past?

Answers

Answer:

"Case-Based Reasoning" is the answer for the above question.

Explanation:

Case-Based Reasoning is a process of decision-making theory in which the new problems were solved based on the previously solved problem.It is used in artificial intelligence and robots. This helps to make any AI and robots to do the work and take decisions on its own.The theory is used to make any computer that behaves like humans. It can take decisions like a human. The above question asked about the method by which the new problem is solved on behalf of the old problem. Hence the answer is "Case-Based Reasoning".

An alternative to hexadecimal notation for representing bit patterns is dotted decimal notation in which each byte in the pattern is represented by its base ten equivalent. In turn, these byte representations are separated by periods. For example, 12.5 represents the pattern 0000110000000101 (the byte 00001100 is represented by 12, and 00000101 is represented by 5), and the pattern 100010000001000000000111 is represented by 136.16.7. Represent each of the following bit patterns in dotted decimal notation. 0000111100001111 001100110000000010000000 0000101010100000

Answers

Answer:

Represent each of the following bit patterns in decimal notation.

Process for conversion:

1. Divide the bit pattern into equal parts.

2. Every digit represent by base 2 with different powers from 0 to 7.

3. Then match the binary number to respective digits of base 2.

4. Neglect numbers that represent by 0 and add numbers that represent by 1.

5. Then place dot between results obtained from different parts.

Part 1:  Answer = 15.15

Part 2:  Answer=51.0.128

Part 3:  Answer=10.160

See attachment for each part

A ________ is a software application that can be used to locate and display Web pages, including text, graphics, and multimedia content. Group of answer choices proxy server Webcam keylogger Webmaster Web browser

Answers

Answer:

"Web browser" is the correct answer for the above question.

Explanation:

A web browser is a software of the computer system which is used to display the page of the internet which is also called the website.It can help to display because it interprets the HTML language and the network pages or websites are written in the form of HTML language.There are so many examples of web browsers, like safari, chrome e.t.c.The above question asked about the software which is used to display the content of the website which is a web browser. Hence web browser is the correct answer while the other option is not correct because:-The webcam is used to capture the image, the keylogger is used for security and the webmaster is not used in the client machine.

Create a new program called Time.java. From now on, we won’t remind you to start with a small, working program, but you should. 2. Following the example program in Section 2.4, create variables named hour, minute, and second. Assign values that are roughly the current time. Use a 24-hour clock so that at 2pm the value of hour is 14. 3. Make the program calculate and display the number of seconds since midnight. 4. Calculate and display the number of seconds remaining in the day. 5. Calculate and display the percentage of the day that has passed. You might run into problems when computing percentages with integers, so consider using floating-point. 6. Change the values of hour, minute, and second to reflect the current time. Then write code to compute the elapsed time since you started

Answers

Answer:

Explanation:

public class time {

public static void main (String[]args) {

 //Step 1  we declare the variables

 int hours, minutes, seconds;

 hours = 17;

 minutes = 12;

 seconds = 00;

 //For checking

 System.out.println(hours+":"+minutes+":"+seconds);

 //Step 2 we make the operation for the seconds since midnight

 int secSinceMidNite;

 secSinceMidNite = ((hours*60)+minutes)*60 + seconds;

 System.out.println("Seconds since midnight = "+secSinceMidNite);

 //Step 3 we make the operation for the seconds remaining in day

 int secRemainingInDay, totalSecInDay;

 totalSecInDay = 24*60*60;

 secRemainingInDay = totalSecInDay - secSinceMidNite;

 System.out.println("Seconds remaining in day = "+secRemainingInDay);

 //Step 4 in the operation for percentage of day that has passed

 int percentOfDayPassed;  

 percentOfDayPassed = (secSinceMidNite*100)/totalSecInDay;

 System.out.println("Percentage of day that has passed = " +percentOfDayPassed+"%");

}

}

Assume that the data on a worksheet consume a whole printed page and two columns on a second page. You can do all of the following except what to force the data to print all on one pageIncrease the left and right margins.

Answers

Answer:

Increase the left and right margins.

Explanation:

Microsoft Excel is a spreadsheet application package from the Microsoft office package. It is a tool used for analysing and cleaning and/or organising information.

It's worksheets are made of cells located by columns or fields and rows or records. A collection of worksheets is called a workbook. An Excel file can be printed after use.

When a print layout is viewed and printed, and columns of the file is printed on another page. To avoid this, reduce the size of the columns and the size of the left and right margins and also decrease the scale value and change to a bigger paper printer size if required.

In BitTorrent, if Alice provides chunks to Bob throughout a 30-second interval, Bob will return the favor and provide chunks to Alice in the same interval only if she is one of the top four neighbors to Bob during this interval.
True or False?

Answers

False, as it is not necessary for Bob to return the chunks to Alice in the same interval in Bit Torrent.

Explanation:

This can be done, if Alice is at the top neighbors list of Bob.Then Bob needs to send a message to Alice.This scenario can occur even if Alice not provide the chunks in the 30 second interval to BobHence, the answer for the given question might be False. As this is a case of may or may not happen.

Write an expression that will cause the following code to print "Equal" if the value of sensorReading is "close enough" to targetValue. Otherwise, print "Not equal".

Answers

Full Question

Write an expression that will cause the following code to print "Equal" if the value of sensorReading is "close enough" to targetValue. Otherwise, print "Not equal". Ex: If targetValue is 0.3333 and sensorReading is (1.0/3.0), output is: Equal

#include <iostream>

#include <cmath>

using namespace std;

int main() {

double targetValue;

double sensorReading;

cin >> targetValue;

cin >> sensorReading;

if (/* Your solution goes here */) {

cout << "Equal" << endl;

} else {

cout << "Not equal" << endl;

} return 0;

}

Answer:

if (abs(targetValue - sensorReading) <= 0.0001)

Explanation:

Replace

if (/* Your solution goes here */) {

With

if (abs(targetValue - sensorReading) <= 0.0001)

Two values are considered to be close enough if the difference between the values is 0.0001

Splitting the codes into bits;

abs

targetValue - sensorReading

<=

0.0001

The keyword abs is to return the absolute value of the expression in bracket.

This is needed because the expression in the bracket is expected to return a positive value.

To do this the absolute keyword is required.

targetValue - sensorReading returns the difference between the variables

<= compares if the difference falls within range that should be considered to be close enough

0.0001 is the expected range

Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. The output of the program is every word in the list that contains the character at least once. Assume at least one word in the list will contain the given character. Assume that the list of words will always contain fewer than 20 words.

Answers

Final answer:

The question asks for a program that reads an integer representing the number of words in a list, the words themselves, and a character, and then prints each word from the list that contains the character at least once. A sample Python script has been provided to illustrate how this can be achieved by iterating through the list and checking for the presence of the character in each word.

Explanation:

To create a program that reads an integer, a list of words, and a character, where the integer indicates the number of words in the list, and the output displays every word containing the specified character at least once, you would typically use a programming language like Python. The task involves iterating through the list of words and checking if each word contains the character. Here is a simple example in Python:

# Read the integer
n = int(input('Enter the number of words: '))

# Read the list of words
word_list = []
for i in range(n):
   word = input('Enter word #' + str(i+1) + ': ')
   word_list.append(word)

# Read the character
c = input('Enter the character to search for: ')

# Output words containing the character
for word in word_list:
   if c in word:
       print(word)

This script prompts the user to input the number of words, the words themselves, and the character to search for. It then prints out any word that contains the character.

Write a loop that prints each country's population in country_pop. Sample output with input: 'China:1365830000,India:1247220000,United States:318463000,Indonesia:252164800': United States has 318463000 people. India has 1247220000 people.

Answers

Answer:

Hi there! This question is good to check your understanding of loops. To illustrate, I have implemented the answer in Python and explained it below.

Explanation:

Assuming user input for the country and population list as provided in the question, we can write the python script "country_pop.py" and run it from the command line. First we prompt user for the input, after which we split the country-population list which is separated or delimited with a comma into an array of country-population list. We then create a hash of country and its corresponding population by further splitting the country-population combo into a hash, and finally, printing the resultant hash as the output.    

country_pop.py

def add_country_pop(country, population):

 countrypop_hash[country]=population

countrypop_hash = {}

input_string = input("Enter country population list: ")

print(input_string)

countrypop_array = input_string.split(",")

for country in countrypop_array:

 country_pop = country.split(':')

 pop_country = country_pop[0]

 population = country_pop[1]

 add_country_pop(pop_country, population)

 print(country + ' has ' + population + ' people')

Output

> country_pop.py

Enter country population list: China:1365830000,India:1247220000,United States:318463000,Indonesia:252164800

China:1365830000,India:1247220000,United States:318463000,Indonesia:252164800

China:1365830000 has 1365830000 people

India:1247220000 has 1247220000 people

United States:318463000 has 318463000 people

Indonesia:252164800 has 252164800 people

Answer:user_input = input()

entries = user_input.split(',')

country_pop = {}

for pair in entries:

   split_pair = pair.split(':')

   country_pop[split_pair[0]] = split_pair[1]

   # country_pop is a dictionary, Ex: { 'Germany':'82790000', 'France':'67190000' }

for country,pop in country_pop.items():  

   print(f'{country} has {pop} people.')

Explanation:

If 2 bits of a byte are in error when the byte is read from ECC memory, can ECC detect the error? Can it fix the error?

Answers

Answer:

Explanation:

Error-correcting code memory (ECC memory) these kinds of memories can detect and correct errors but only in single bit of the byte, in this case, if there is more than one bit, for example, two bits, the ECC memory can detect the error but cannot fix it, there are some memories without ECC can detect errors but not correct it.

2.29 LAB: Using math functions Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to the power of 2), the absolute value of y, and the square root of (xy to the power of z). Output each floating-point value with two digits after the decimal point, which can be achieved as follows: printf("%0.2of", your Value); Ex: If the input is: 5.0 6.5 3.2 the output is: 172.47 340002948455826440449068892160.00 6.50 262.43

Answers

The code is in C.

We use the built-in functions to make the required calculations. These functions are already defined in C. We need to import math.h to be able to use the pow(), fabs(), and sqrt() functions

Comments are used to explain each line of the code

//main.c

//importing the required libraries

#include <stdio.h>

#include <math.h>

#include <stdlib.h>

int main(){

  //Declaring the variables x, y, z

  float x, y, z;

 

  //Getting inputs for x, y, z

  scanf("%f", &x);

  scanf("%f", &y);

  scanf("%f", &z);

  //Calculating the x to the power of z using the pow function

  double result1 = pow(x, z);

 

  //Calculating the x to the power of (y to the power of 2) using the pow function inside the another pow function

  double result2 = pow(x, pow(y, 2));

 

  //Calculating the absolute value of y using the fabs function

  double result3 = fabs(y);

 

  //Calculating the square root of (xy to the power of z) using the sqrt and pow functions

  double result4 = sqrt(pow(x * y, z));

 

  //Printing the results using prinntf("%0.2f") to get the two digits after decimal value

  printf("%0.2f\n", result1);

  printf("%0.2f\n", result2);

  printf("%0.2f\n", result3);

  printf("%0.2f\n", result4);

  return 0;

}

You may check a similar question in the following link:

brainly.com/question/14936511

The code takes three floating-point numbers as input (x, y, and z), computes the required expressions using the `pow()` function for exponentiation and the `fabs()` function for absolute value, and then prints the results with two digits after the decimal point using `printf()` formatting.

Here's a C code snippet that implements the required functionality:

#include <stdio.h>

#include <math.h>

int main() {

   double x, y, z;

   scanf("%lf %lf %lf", &x, &y, &z);

   double result1 = pow(x, z);

   double result2 = pow(x, pow(y, 2));

   double result3 = fabs(y);

   double result4 = sqrt(pow(x * y, z));

   printf("%0.2lf %0.2lf %0.2lf %0.2lf\n", result1, result2, result3, result4);

   return 0;

}

If data from a DOS system is electronically sent to an EHR or other Windows-based system via an interface to populate an indexed data field in the EHR, after the data is in the EHR is it structured or unstructured?

Answers

Answer:

yes ! you can see below.

Explanation:

EHR is a health record of a patient that gives information about the patient and securely authorized it. Electronic Health record allows medical professionals to enter data and update a new encounter.

DOC is a document used by Microsoft. DOC file is a file that contains formatted text, images, tables, graphs, and charts, etc.

Unstructured data is data that can be entered in free text format. Structured information is a type of data contain check boxes, images table, and other the user chooses from the given option.

As the DOC system contain free text format, then data in the EHR is structured.

The data sent from a DOS system to an EHR and populating an indexed field is typically considered structured data. EHR systems play a critical role in maintaining accessible and secure patient records, improving healthcare quality and efficiency while safeguarding privacy.

If data from a DOS system is electronically sent to an EHR (Electronic Health Record) or other Windows-based system via an interface to populate an indexed data field in the EHR, the data can be either structured or unstructured depending on the format it is sent and how it is handled by the receiving system. In this context, if the data populates a specific field within the EHR, it is typically considered to be structured data because it is organized in a predefined manner, making it easily searchable and analyzable within the system.

EHR systems are essential for maintaining accurate and accessible patient records. They ensure that in the event of a disaster, such as a hurricane, health information can be retrieved due to effective data backup solutions. Additionally, because EHRs are designed to be shared securely among healthcare providers, they facilitate improved coordination of care.

Overall, the transformation from paper-based records to EHRs serves to enhance the quality and efficiency of healthcare delivery, while also maintaining the privacy and security of personal health information under federal laws such as HIPAA.

What are the design concepts and assumptions behind a class, an object and the relationship between them? What are the roles methods and static fields play in OOP?

Answers

Answer:

Object-oriented programming (OOP) is a procedural language and based on classes associated with an object. Without classes and object relationship OOP is not possible. According to program's design concept classes provide abstraction and encapsulation with the help of object. Object have states and behaviors like cat has states like name, color and  cat has also behaviors like  wagging the tail, eating, jumping etc. A class forms template or blueprints for these states and behaviors because different cats have different behaviors and states.

Methods provide a way for encapsulation and accessing private class members with public methods and static fields are sometimes best alternative for global variable. We can use static field when it same for all and shared by all objects of that class and it can save memory because we do not have to initialize it for each object

Final answer:

In Object-Oriented Programming (OOP), a class is a blueprint for creating objects, while an object is an instance of a class. The relationship between a class and an object is that a class defines the structure of an object. Methods in OOP are used to perform actions or computations, while static fields are shared among all objects of a class.

Explanation:

Design Concepts and Assumptions in OOP:

In Object-Oriented Programming (OOP), a class is a blueprint for creating objects, while an object is an instance of a class. The design concept behind a class is to define the common characteristics and behaviors that objects of that class will have. Assumptions made when designing a class include creating a hierarchy of classes to represent different levels of abstraction and encapsulating data and behaviors within the class.

Relationship between Class and Object:

In OOP, the relationship between a class and an object is that a class defines the structure (attributes and behaviors) of an object, while an object is an instance of a class that can be created and manipulated using the defined structure.

Roles of Methods and Static Fields in OOP:

In OOP, methods are functions or behaviors associated with an object or class, which are used to perform certain actions or computations. They define how objects or classes interact with each other and with the outside world. Static fields, on the other hand, are variables or data that are shared among all objects of a class. They hold values that are common to all instances of the class and can be accessed without creating an object.

What is virtualization? What are the benefits we can have with it?

Answers

Explanation:

Virtualization can be defined as a virtual or software-based representation of virtual applications, storage, network and servers. Through this process it is possible to run a variety of different operating systems on the same physical server at the same time, which reduces information technology expenses, increases the speed and agility of the systems.

Some of the benefits of virtualization are:

Reduced hardware costsEasy backup and restoration of complete servers Reduction of electricity consumptionFaster deployment of new machines

Two co-workers at Nortel came up with an idea for renting software over the Internet. Nortel's top management liked the idea and set up a special division called Channelware devoted to taking the idea and making a new product. The establishment of a new company and assigning the employees in the division the task of making an idea a reality requires which management function?

Answers

Answer:

The correct answer is: Organizing.

Explanation:

Management functions refer to the roles high-rank executives must play to handle businesses. Those functions are Planning, Organizing, Staffing, Directing, and Controlling. Organizing refers to the steps taken to create a structure in the organization. Managers should find the most optimal way to group the firm's resources to ensure efficiency and effectiveness. The process of organizing includes:

Identification of activities Grouping of activities Assigning of responsibilities Granting authority Establishing relationships

Write a program that gets a single character from the user. If the character is not a capital letter (between 'A' and 'Z'), then the program does nothing. Otherwise, the program will print a triangle of characters that looks like this:

Answers

This question is incomplete. The complete question is given below:

Write a program that gets a single character from the user. If the character is not a capital letter (between 'A' and 'Z'), then the program does nothing. Otherwise, the program will print a triangle of characters that looks like this:

  A

 ABA

ABCBA

ABCDCBA

Answer:

#include <stdio.h>

void printTri(char asciiCharacter){

   // Row printer

//   for(int i = 65; i <= ((int)asciiCharacter); i++){

   int i = 65;

   while(i <= ((int)asciiCharacter)){

       int leftMargin = ((int)asciiCharacter) - i; +

       int j = 1;

       while(j <= leftMargin){

           printf(" ");

           j++;

       }

       int k = 65;

       while(k < ((int)i)){

           printf("%c",(char)k);

           k++;

       }

       int l = ((int)i);

       while(l >= 65){

           printf("%c",(char)l);

           l--;

       }

       printf("\n");

       i++;

   }

}

int main()

{

   for(;;){

       printf("Please enter a character between A and Z. Enter (!) to exit \n");

       char in;

//       scanf("%c",&in);

       in = getchar();

       getchar();

       printf("Printing Triangle for: %c \n",in);

       if(((int)in) >= 65 && ((int)in) <= 90){

           printTri(in);

           printf("\n");

       }else if(((int)in) == 33){

           break;

       } else {

           continue;

       }

   }

   return 0;

}

Explanation:

Inside the printTri function, print spaces, characters in order as well as characters in reverse order.Inside the main function, take the character as an input from user then print the triangle by validating first to ensure that the character lies between a to z alphabets.

What are the differences between a trap (aka software interrupt) and an interrupt (hardware interrupt)? What is the use of each function

Answers

Answer:

Trap is a software interrupt that occurs when there is a system call, while hardware interrupt occurs when a hardware component needs urgent attention.

Explanation:

Interrupt is an input signal that disrupt the activities of a computer system, giving immediate attention to a hardware or software request.

In trap interrupt, the system activities are stop for a routine kernel mode operation, since it has a higher priority than the user mode. At the end of the interrupt, it switches control to the user mode.

The hardware interrupt is a signal from hardware devices like the input/output devices, storage and even peripheral devices that draws an immediate attention of the processor, stopping and saving other activities and executing the event with an interrupt handler.

How can this be accomplished by Universal Containers?
Universal containers wants to provide a different view for its users when they access an Account record in Salesforce1 instead of the standard web version.
A. By adding a mobile layout and assigning it to a profile.
B. By adding quick actions in the publisher section
C. By adding actions in the Salesforce1 action bar section.
D. By adding Visualforce page to the mobile cards section.

Answers

Answer:

Option A and Option D are the correct options.

Explanation:

They decided to allow their users with a different perspective when viewing a Salesforce1 transaction records rather than the specific web edition. So, they accomplish the following scenario by adding and allocating a Mobile Design to a profile and by adding the following page to the mobile card section.

Give state diagrams of DFAs that recognize the following languages.
In all parts, the alphabet is {0, 1}.
(a) {w|w begins with a 1 and ends with a 0}
(b) {w|w contains at least three 1s}
(c) {w|w contains the substring 0101, i.e., w = x0101y for some strings x, y}

Answers

Answer:

Following is attached the solution of each part step-by-step. I hope it will help you!

Explanation:


I need help in creating a Java Program; To calculate the chapter from which you solve the programming exercise, below are the requirements;

• Divide the integer number representing your student ID by 4, consider the remainder and increment it by 2. The result you obtain represents the chapter number, and it should be either 2, 3 , 5 or 6.

* Depending on the chapter number obtained above, consider the following rules in calculating the problem number to solve:

• If the chapter number is 2, divide your student ID by 23, consider the remainder and increment it by 1. The result you obtain represents the number of the programming exercise you will solve for online discussions, which should be from chapter 2.

• If the chapter number is 3, divide your student ID by 34, consider the remainder and increment it by 1. The result you obtain represents the number of the programming exercise you will solve for online discussions, which should be from chapter 3.

• If the chapter number is 4 (you need to go to chapter 6), divide your student ID by 38, consider the remainder and increment it by 1. The result you obtain represents the number of the programming exercise you will solve for online discussions, which should be from chapter 6.

• If the chapter number is 5, divide your student ID by 46, consider the remainder and increment it by 1. The result you obtain represents the number of the programming exercise you will solve for online discussions, which should be from chapter 5.

*After calculating the number of the chapter, and the number of the programming exercise to solve, ask the user to enter the page number where the specific problem is located in the textbook. Display the requirement for the programming exercise using the following format: "Please solve programming exercise … (include here the number of the exercise) from chapter … (include here the number of the chapter), from page … (include here the page number)."

Answers

Answer:

 public static void main(String[] args)

 {

   int studentnumber = 123456;

   int divisor = 0;

   int chapter = (studentnumber%4)+2;

   

   switch(chapter) {

     case 2:

      divisor = 23;

      break;

     case 3:  

      divisor = 34;

       break;

     case 4:

      divisor = 38;

       break;

     case 5:  

      divisor = 46;

       break;

   }

   

   int exercise = (studentnumber % divisor) + 1;

   

  System.out.printf("Studentnumber %d divided by 4 plus 2 is chapter %d.\n", studentnumber, chapter);        

  System.out.printf("Studentnumber %d divided by %d is exercise %d.", studentnumber, divisor, exercise);  

 }

Explanation:

Above is just a bit of code to get you started with the first part. Hope you can figure out the rest.

Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in a program that takes two integer inputs, and outputs the largest magnitude value.
Ex: If the inputs are:

5 7
the function returns:

7
Ex: If the inputs are:

-8 -2
the function returns:

-8
Note: The function does not just return the largest value, which for -8 -2 would be -2. Though not necessary, you may use the absolute-value built-in math function.

Your program must define and call a function:
int MaxMagnitude(int userVal1, int userVal2)

code------------------------

#include
using namespace std;

/* Define your function here */

int main() {
/* Type your code here */

return 0;
}

Answers

Answer:

def max_magnitude(user_val1, user_val2):

if abs(user_val1) > abs(user_val2):

return user_val1

else:

return user_val2

if __name__ == '__main__':

n1 = int(input("Enter the first integer number: "))

n2 = int(input("Enter the second integer number: "))

print("The largest magnitude value of", n1, "and", n2, "is", max_magnitude(n1, n2))

Explanation:

Given that ph refers to a float, write a statement that compares ph to 7.0 and makes the following assignments (RESPECTIVELY!) to the variables neutral, base, and acid:

0,0,1 if ph is less than 7
0,1,0 if ph is greater than 7
1,0,0 if ph is equal to 7

Answers

Final answer:

The pH scale measures how acidic or basic a substance is. Human blood (pH 7.4) is basic, household ammonia (pH 11.0) is also basic, and cherries (pH 3.6) are acidic.

Explanation:

To compare the value of ph to 7.0, we can use an if-else statement in Python. We can assign the values to the variables neutral, base, and acid as follows:

If ph is less than 7, assign 0,0,1 to neutral, base, and acid respectively.If ph is greater than 7, assign 0,1,0 to neutral, base, and acid respectively.If ph is equal to 7, assign 1,0,0 to neutral, base, and acid respectively.

Create an application named TestClassifiedAd that instantiates and displays at least two ClassifiedAd objects. A ClassifiedAd has fields for a Category (For example, Used Cars and Help Wanted), a number of Words, and a price. Include properties that contain get and set accessors for the category and number of words, but only a get accessor for the price. The price is calculated at nine cents per word.

Answers

Answer:

Following is given the code with all necessary descriptions as comments in it. The output is also attached under the code. I hope it will help you!

Explanation:

```csharp

using System;

class ClassifiedAd

{

   // Fields

   private string category;

   private int numberOfWords;

   // Properties

   public string Category

   {

       get { return category; }

       set { category = value; }

   }

   public int NumberOfWords

   {

       get { return numberOfWords; }

       set { numberOfWords = value; }

   }

   public double Price

   {

       get { return numberOfWords * 0.09; } // Price calculated at nine cents per word

   }

}

class TestClassifiedAd

{

   static void Main(string[] args)

   {

       // Instantiate ClassifiedAd objects

       ClassifiedAd ad1 = new ClassifiedAd();

       ad1.Category = "Used Cars";

       ad1.NumberOfWords = 50;

       ClassifiedAd ad2 = new ClassifiedAd();

       ad2.Category = "Help Wanted";

       ad2.NumberOfWords = 80;

       // Display information about the ClassifiedAd objects

       Console.WriteLine("Classified Ad 1:");

       Console.WriteLine($"Category: {ad1.Category}");

       Console.WriteLine($"Number of Words: {ad1.NumberOfWords}");

       Console.WriteLine($"Price: ${ad1.Price}");

       Console.WriteLine("\nClassified Ad 2:");

       Console.WriteLine($"Category: {ad2.Category}");

       Console.WriteLine($"Number of Words: {ad2.NumberOfWords}");

       Console.WriteLine($"Price: ${ad2.Price}");

   }

}

```

1. ClassifiedAd Class:

  - This class represents a classified advertisement with three fields: `category`, `numberOfWords`, and a private field `price` (which is calculated internally).

  - Properties:

    - `Category`: This property has both a getter (`get`) and a setter (`set`) to allow getting and setting the category of the advertisement.

    - `NumberOfWords`: Similarly, this property has both a getter and a setter for getting and setting the number of words in the advertisement.

    - `Price`: This property only has a getter (`get`). It calculates the price based on the number of words (`numberOfWords * 0.09`), where each word costs nine cents.

2. TestClassifiedAd Class:

  - This is the main application class that demonstrates the use of `ClassifiedAd` objects.

  - Main Method:

    - It instantiates two `ClassifiedAd` objects (`ad1` and `ad2`) and assigns values to their properties (`Category` and `NumberOfWords`).

    - It then prints out information about each `ClassifiedAd` object:

      - Displays the category using `ad1.Category` and `ad2.Category`.

      - Displays the number of words using `ad1.NumberOfWords` and `ad2.NumberOfWords`.

      - Displays the calculated price using `ad1.Price` and `ad2.Price`.

3. Execution:

  - When you run the `TestClassifiedAd` application, it will output the category, number of words, and price for each of the two `ClassifiedAd` objects that were instantiated and configured.

4. Purpose:

  - This code demonstrates basic object-oriented principles such as encapsulation (using properties to access fields), calculation within properties, and object instantiation and usage in a simple console application.

Overall, the `ClassifiedAd` class encapsulates the data and behavior related to a classified advertisement, and the `TestClassifiedAd` application showcases the instantiation and usage of these objects with specific examples.

A palindrome is a word or phrase that reads the same both backward and forward. The word ""racecar"" is an example. Create an algorithm (sequence of steps) to determine if a word or phrase is a palindrome. Try several different words or phrases to ensure your algorithm can detect the existence of a palindrome properly.

Answers

Answer:

Algorithm for the above problem:

Take a string from the user input.store the input string on any variable.Reverse the string and store it on the other variable.Compare both strings (character by character) using any loop.If all the character of the string matched then print that the "Input string is a palindrome".Otherwise, print "The inputted string is not a palindrome."

Output:

If the user inputs "ababa", then it prints that the "Input string is palindrome"If the user inputs "ababaff", then it prints that the "Input string is not palindrome"

Explanation:

The above-defined line is a set of an algorithm to check the number is palindrome or not.It is defined in English because the algorithm is a finite set of instructions written in any language used to solve the problem. The above algorithm takes input from the user, compare that string with its reverse and print palindrome, if the match is found.

Write a program that fills half the canvas with circles in a diagonal formation.
Have Tracy draw circles along the width of the canvas on the bottom row. Have the number of circles decrease by 1 on each iteration until there is only 1 circle on the top row.

Answers

Answer:

Explanation:

function draw()

 {

 var ctx = document.getElementById("myCanvas").getContext("2d");

 var counter = 0;

 for (var i=0;i<6;i++)

 {

 for (var j=0;j<6;j++)

 {

 //Start from white and goes to black

 ctx.fillStyle = "rgb(" + Math.floor(255-42.5*i) + "," + Math.floor(255-42.5*i) +

 "," + Math.floor(255-42.5*j) + ")";

ctx.beginPath();

 if (i === counter && j === counter)

 {

 //creates the circles

 ctx.arc(25+j*50,30+i*50,20,0,Math.PI*2,true);

 ctx.fill();

 //creates a border around the circles so white one will be vissible

 ctx.stroke();

 }  

 }

 counter++;

 }

 }

 draw();

Given positive integer numInsects, write a while loop that prints that number doubled without reaching 200. Follow each number with a space. After the loop, print a newline. Ex: If numInsects = 16, print:16 32 64 128 import java.util.Scanner;public class InsectGrowth {public static void main (String [] args) {int numInsects;Scanner scnr = new Scanner(System.in);numInsects = scnr.nextInt(); // Must be >= 1/* Your solution goes here */}}

Answers

Answer:

The below code is pasted in the place of "/*Your solution goes here */"

while(numInsects<200) // while loop

       {

            System.out.print(numInsects+" "); // print statement

            numInsects=numInsects*2; // operation to print double.

       }

Output:

If the user gives inputs 16 then the output is 16 32 64 128.If the user gives inputs 25 then the output is 25 50 100.

Explanation:

The above code is in java language in which the code is pasted on the place of "Your solution" in the question then only it can work.Then the program takes an input from the user and prints the double until the value of double is not 200 or greater than 200.In the program, there is while loop which checks the value, that it is less than 200 or not. If the value is less the operation is performed otherwise it terminates.

Using Python 3 programming, the code blocks below displays the required instructions. The program goes thus :

numInsects = int(input())

#takes input from the user on the number of insects

while numInsects < 200 :

#while loop checks if variable is below 200

print(numInsects, end=' ')

#displays the value with the cursor remaining on the same line

numInsects*=2

print(numInsects)

Learn more : https://brainly.com/question/12483071

Other Questions
A leader earns the respect and cooperation of employees to effectively accomplish the work of the organization. * 2 points True False Which level of government provides the most services to citizens?A) federalB) localC) nationalD) state The balanced equation for the combustion of ethanol is 2C2H5OH(g) + 7O2(g) 4CO2(g) + 6H2O(g) How many grams of oxygen gas are required to burn 5.54 g of C2H5OH? (write your answer with 3 sig figs and no units) 0.230769231 as a fraction Assume that 200 births are randomly selected and 6 of the births are girls. Use subjective judgment to describe the number of girls as significantly high, significantly low, or neither significantly low nor significantly high. Choose the correct answer below. A. The number of girls is neither significantly low nor significantly high. B. The number of girls is significantly low. C. The number of girls is significantly high. To be recorded, a deed must have: (a)the signature of the grantee. (b)a mention of consideration. (c)a seal. (d)an address where tax bills should be mailed. 1. What triangular-shaped landform is located along the western side of the Gulf ofAqaba? A common practice in cooking is the addition of salt to boiling water (Kb = 0.52 C kg/mole). One of the reasons for this might be to raise the temperature of the boiling water. If 2.85 kg of water is boiling at 100 C, how much NaCl (MW = 58.44 g/mole) would need to be added to the water to increase the boiling point by 2 C? Must show your work. prove the identity cos(x-y)-cos(x+y)=2sinx siny If Alex and Brandon work together, they will finish cleaning the school in 15 hours. Working alone, Brandon can finish the same job in 20 hours. How long will it take Alex to do the job by himself? If you use a 95% confidence level in a two-tail hypothesis test, what will you decide about your Null Hypothesis if the computed value of the test statistic is Z = 2.57? Why? Your coin collection contains fifty 1949 silver dollars. Your grandparents purchased them for their face value when they were new. These coins have appreciated at a 7.6 percent annual rate. This rate is expected to continue. How much will your collection be worth when you retire in 2020 Problem 6-13 Pricing Consol Bonds (LO2) Perpetual Life Corp. has issued consol bonds with coupon payments of $60. (Consols pay interest forever and never mature. They are perpetuities.). If the required rate of return on these bonds at the time they were issued was 6%, at what price were they sold to the public? How do you do this question? What is the molality of aqueous nitric acid HNO3 (63 g/mol) that has a density of 1.42 g/mL and is 16.7 M? Report your answer to three significant figures. Do not include units. Select the correct answer.Which event most directly caused the Glorious Revolution? The Olympic Project was set up as an open source website to collect evidence for Bigfoot. Evidence collected was to be assessed by a team of researchers. Was this science or pseudoscience? A colony of bacteria originally contains 200 bacteria. It doubles in size every 30 minutes. How many hours will it take for the colony to contain 2,000 bacteria? (Round your answer to one decimal place.) Littlefield Industries purchased a bond on September 1 of the current year for $200,000 and classified the investment as trading debt. The market value of the trading debt investment at year-end is $196,000. The adjustment is ______. Use scalar projection to show that the distance from a point P1(x1,y1) to the line ax+by+c=0 is |ax1+by1+c|/underroot(a^2 +b^2)Use this formula to find the distance from the point (-2,3) to the line 3x-4y+5=0