Write a procedure that takes a positive integer as a parameter. If the number given to the procedure is no more than 30, the procedure should return the absolute difference between that number and 30

Answers

Answer 1

Question (continuation):

If the number is greater than 30, the procedure should return the number doubled.

Answer:

The procedure written in C++ is as follows:

void absdiff(int num){

   if(num<=30){

       num = abs(num - 30);

   }

   else{

       num*=2;

   }

   cout<<num;

}

Explanation:

This defines the procedure

void absdiff(int num){

This checks if the integer parameter is not more than 30.

   if(num<=30){

If yes, the absolute difference between 30 and the number is calculated

       num = abs(num - 30);

   }

If otherwise

   else{

The number is doubled

       num*=2;

   }

This prints the processed result

   cout<<num;

}

See attachment for complete program that includes the main


Related Questions

Which feature of dart helps in making the code readable,maintainable and finds type error during compile time

Answers

Answer:

Sound

Explanation:

Dart is object oriented. It's sound feature helps to make codes more maintainable and readable. The sound type system means that one can never experience w state where where an expression would evaluate to a value that wouldn't match that expressions static type.

The sound system makes the code to be unambiguous. It makes the code to be easier to read as types cannot lie, also your code would be more maintainable since when a piece of code gets to be changed, you would be warned of other pieces that may have gotten broken.

It should be noted that the sound is the feature of dart helps in;

making the code readablemaintainable finds type error during compile time.

According to the question, we are to discuss the feature of dart helps in making the code readable and helps in detecting the error as at time if compilation.

As a result of this we can see that sound system makes the code to be unambiguous and it helps in making the code readable.

Therefore, sound is the feature of dart helps in making the code readable.

Learn more about feature of dart

https://brainly.com/question/14312978

Ask the user to type in an integer greater than 50 and assign it to a variable called x. Write a program to calculate the sum of squares of positive integers. The loop should stop when the sum is greater than x. At the end of the loop print how many numbers were used to calculate the sum. For example, if x is 100, sum will be 91, and six numbers (1 to 6) were used to calculate sum.

Answers

Answer:

The solution in Python is as follows:

num = int(input("Number: "))

if num>50:

    sum = 0

    count = 0

    for i in range(1,num):

         count = count + 1

         sum = sum + i**2

         if sum > num:

              sum = sum - i**2

              count = count - 1

              break;

   

    print("Sum: "+str(sum))

    print("Numbers: "+str(count))

else:

    print("Number must be greater than 50")

Explanation:

The condition stated in the question do not conform with the example. The question says, the loop should stop when sum > x.

But:

When x = 100 and sum = 91, the program loop should not stop because 91 is not greater than 100.

However, I'll answer based on the example given in the question.

This prompts user for number

num = int(input("Number: "))

The following if condition is executed if number is greater than 50

if num>50:

This initializes sum to 0

    sum = 0

This initializes count to 0

    count = 0

The iterates through the inputted number (e.g. 100)

    for i in range(1,num):

This increases the count

         count = count + 1

This calculates the sum of square of the positive integer

         sum = sum + i**2

The following removes excess number from the sum

         if sum > num:

              sum = sum - i**2

              count = count - 1

              break;

This prints the calculated sum    

    print("Sum: "+str(sum))

This prints the count of number used

    print("Numbers: "+str(count))

The following is executed if user input is less than 50

else:

    print("Number must be greater than 50")

A drop light that does not allow any electrical parts to come in contact with the outer casing of the device is called a:

Answers

Answer:

The right answer is "Double insulated light".

Explanation:

Double insulated led is mostly a sophisticated type of natural light that does not necessitate a terrestrial or planetary correlation. These illuminations could be based on these metals, are indicated in the electrical protection environmental standards that now the construction workers comply with, and therefore are readily accessible about every bedroom.


Jim wants to enlarge a black-and-white photograph with a warm-black tone. What type of black-and-white paper emulsion should Jim use for this
process?
A chlorobromide
B. bromide
C. chloride
D platinum

Answers

Answer:

A. Chlorobromide

Explanation:

I took the test and got it right. (Plato)

The type of black-and-white paper emulsion should be used by Jim is chlorobromide. Thus, option (A) is correct.

What is emulsion?

A sort of colloid called an emulsion is created by mixing two liquids that wouldn't typically mix. A dispersion of the other liquid is present in one liquid in an emulsion.

Emulsions frequently occur in foods like egg yolk, butter, and mayonnaise. Emulsification is the process of combining liquids to create an emulsion.

According to the above scenario, Jim wishes to expand a warm-toned black-and-white photograph. For this purpose, he should use chlorobromide for black-and-white paper emulsion.

Paper covered with a chemical compound that is light-sensitive, which is inferred as photographic paper. When exposed to light, it captures the latent image.

Therefore, it can be concluded that option (A) is correct.

Learn more about emulsion here:

https://brainly.com/question/6677364

#SPJ2

What tab on the Ribbon would you select to create a Photo Album?
Design
Animation
Home
Insert

Answers

Answer:

It would be the last one Insert

Explanation:

I just know

Define the summary function, which takes as arguments a database (dict) and a dict of current stock prices. It returns a dictionary (dict or defaultdict) whose keys are client names (str) whose associated values are 2-tuples: the first index is a dictionary (dict or defaultdict) whose keys are stock names (str) and values are the number of shares (int) the client owns. The second index is the amount of money (int) the portfolio is worth (the sum of the number of shares of each stock multiplied by its current price). Assume each client starts with no shares of any stocks, and if a client owns 0 shares of a stock, the stock should not appear in the client’s dictionary. Recall positive numbers are a purchase of the stock and negative numbers a sale of the stock. E.g., if db is the database above, calling summary(db, {'IBM':65, 'Intel':60, 'Dell':55, 'Apple':70}) would return

Answers

Hi :). (_define Your question to answer) ,

All of the following are data providers included with .NET for accessing and manipulating data in databases, EXCEPT ____. Group of answer choices

Answers

Complete Question:

All of the following are data providers included with .NET for accessing and manipulating data in databases, EXCEPT ____.

Group of answer choices.

A. OLE DB

B. ODBC

C. SQL Server

D. Access

Answer:

D. Access

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.

A data dictionary can be defined as a centralized collection of information on a specific data such as attributes, names, fields and definitions that are being used in a computer database system.

In a data dictionary, data elements are combined into records, which are meaningful combinations of data elements that are included in data flows or retained in data stores.

This ultimately implies that, a data dictionary found in a computer database system typically contains the records about all the data elements (objects) such as data relationships with other elements, ownership, type, size, primary keys etc. This records are stored and communicated to other data when required or needed.

Basically, when a database management system (DBMS) receives data update requests from application programs, it simply instructs the operating system installed on a server to provide the requested data or informations.

Some examples of data providers included with .NET for accessing and manipulating data in databases are;

A. OLE DB: this is an acronym for Object Linking and Embedding Database. OLE DB was designed and developed by Microsoft corporation and it comprises of various application programming interfaces (APIs) used for data access.

B. ODBC: it is an acronym for Open Database Connectivity and it was designed and developed by Microsoft corporation used for data access through structured query language (SQL).

C. SQL Server: it is a domain-specific language server designed and developed for managing the various data saved in a relational or structured database.

Split the worksheet into panes at cell G1.

Answers

Answer:

1. Select below the row where you want the split, or the column to the right of where you want the split.

2. On the View tab, in the Window group, click Split.

Explanation:

The process of auditing the source code for an application to verify that the proper security controls are present, that they work as intended, and that they have been invoked in all the right places is known as

Answers

Answer:

Security code review.

Explanation:

The process of auditing the source code for an application to verify that the proper security controls are present, that they work as intended, and that they have been invoked in all the right places is known as security code review.

The main purpose of security code review is to ensure that all the necessary security measures or procedures are adopted (available), to confirm the level of accuracy of its operations, and verify that all loopholes for unauthorized access or use by attackers is prevented.

Hence, various software developers employ the security code review process in order to ensure that the integrity and safety of their software applications or programs are present.

Code review is the process for auditing the source codes and is a an application that is used for verification of the proper security control that are present and that they are intended to use.

The code review is to assure the quality of the software and verity the activity that checks the program mainly for viewing the parts of code.

Learn more about the source code for an application to verify that the

brainly.com/question/24749514.

The following program calculates yearly and monthly salary given an hourly wage. The program assumes a work-hours-per-week of 40 and work-weeks-per-year of 50. Insert the correct number in the code below to print a monthly salary. Then run the program. The monthly salary should be 3333.333... .

Answers

Answer:

The program implemented in Python is as follows:

hourly=float(input("Hourly Wage: "))

print("Annual Rate: "+str(hourly * 40 * 50))

print("Monthly Rate: "+str(round((hourly * 40 * 50/12),2)))

Explanation:

The question is incomplete as the missing code is not given. However, I've written the program from scratch in python.

This prompts the program user for the hourly Wage;

hourly=float(input("Hourly Wage: "))

This calculates and prints the annual rate

print("Annual Rate: "+str(hourly * 40 * 50))

This calculates and prints the monthly rate

print("Monthly Rate: "+str(round((hourly * 40 * 50/12),2)))

Note:

The annual rate is calculated by multiplying the hourly wage to number of hours per week (40) to number of weeks per year (50)

The monthly rate is calculated by [tex]annual\ rate/12[/tex]

Reading Materials Design and implement a set of classes that define various types of reading material: books, novels, magazines, technical journals, textbooks, and so on. Include data values that describe various attributes of the material, such as the number of pages and the names of the primary characters. Include methods that are named appropriately for each class and that print an appropriate message. Create a main driver class to instantiate and exercise several of the classes.

Answers

Answer:

Answered below

Explanation:

//The designs are implemented in Kotlin.

//Book class

class Book (val title: String,

val type: String,

val numberOfPages: Int,

val author: String ,

val yearPublished: Int ) {

fun bookDescription( ){

print("Book title is $title. Written

by $author and published

in $yearPublished" )

}

}

//Driver class

class Main {

fun main( ) {

val novel: Book = Book("Animal Farm", "novel", 200, "Orwell", 1990 )

println(novel.title)

println(novel.author)

val description = novel.bookDescription( )

println(description)

val magazine: Book = Book("Forbes", "magazine", 50, "Michael", 1995)

}

}

Other Questions
Puntos gratis! Har ms despus. PLEASE HELP! ALL MY POINTS PLEASE!Revise the passage below so that it maintains a formal style and tone throughout.READ ^^Most fine arts classes, including visual art, music composition, dance, theater, and creative writing, feature a peer-review component in which students provide feedback on their classmates' work. Some art teachers maintain that peer review is a valuable teaching tool that not only helps student artists reimagine their work but also pushes student critics to develop their taste and technical vocabulary. The thing that's wrong with this is that sometimes people give really lame feedback and don't get how to be nice. When that happens, feelings can be hurt, and the peer-review process can become unproductive Does anyone know how to do this, Im failing math and I need this to boost my grade. Someone help please theres a pic plz hurry The huge distances in the Cosmos are measured in _________ and __________. Calculate the slope of the line.Please help!! 1. My friend and I will PART company after dinner. I won't see him until he returns from vacation.What does the word part mean in this sentence?(1 Point)separateactor's role in a playa line where hair is combed in different directionspiece factories:x(x+1)-y(y+1) Where are the most biodiverse ecosystems found on Earth? How do you know this? Which part of speech is the compound word in the following sentence? "When the paper company downsized, Mr. Porter lost his accounting job."A. Adjective.B. adverb.C. nounD. verb Which of the following shows -7(4 + y) rewritten using the DistributiveProperty?0 -35yO -11 -7yO -28 - 7y-28 + 7y What would the role of music in today's society explain about the past 20 years from now? Which of these sentences should use por instead of para? A. I will walk to the streets. B. I'm going home to sleep. C. I'm going to the movies. D. For me a coffee. Organisms can be classified asand Which describes the slope of the line in the graph?A)zeroB)positiveC)negativeD)undefined Answer these two easy questions i give out brainlest 4 of 4The ratio of money in Brian's wallet to Colin's wallet one day was 7:2.Brian spent 39 that day.Brian now had 4 less than Colin.How much did they initially have altogether? 4.28 ounces - 4.82 ounces-2.85 ounces How does temperature affect pressure?As temperature increases so does pressure.Pressure is not affected by temperature.Pressure will always increase if temperature increases or decreases.As temperature increases, pressure decrease. Which sentence correctly uses an adverbial phrase?O A. Dr. Hernandez left with a spring in his step.B. Dr. Hernandez left springs in his steps.C. Dr. Hernandez had a spring in his step.D. Dr. Hernandez, showing a spring in his step, left.