Write a perl subroutine for temperature conversion

Assignment Help PL-SQL Programming
Reference no: EM1389800

Question 1:

Write a perl subroutine for temperature conversion named 'convert_temp'. It should be able to handle both Fahrenheit to Celsius conversions as well as Celsius to Fahrenheit conversions. It must accept and read two arguments that are passed to it: first, the temperature scale of the original temperature (only 'F' or 'C' should be used), and second, the number of degrees of the original temperature. It should then convert the original temperature from Fahrenheit to Celsius or from Celsius to Fahrenheit, as appropriate. Finally, this subroutine should print out the original temperature and scale as well as the converted temperature and scale.

Then write a short program to use the subroutine you wrote (both the subroutine and program should be part of the same file). Your program should prompt the user to enter a temperature scale (assume the user will choose to type 'F' or 'C') and then prompt the user to enter a number of degrees. Using the values supplied by the user, the program should then call the 'convert_temp' subroutine and pass in the two arguments, along these lines:

convert_temp($scale, $degrees);

and the subroutine should produce a line of output that looks like this (for Fahrenheit to Celsius):

            98.6 degrees F is 37.0 degrees C

or, for a Celsius to Fahrenheit conversion:

            100.0 degrees C is 212.0 degrees F

The first temperature and scale that you should report are those that the user entered, followed by the converted temperature and other scale.

Question 2:

Write a program that prompts the user to enter an oligonucleotide sequence, such as TATGAGCCCGTA. If the user entered a valid oligo sequence consisting only of the characters A, C, G, or T, the program should then display the reverse complement of that sequence, in this case TACGGGCTCATA, along with text indicating that it is the reverse complement.

After displaying the reverse complement, the program should then prompt the user to enter another sequence. The program should continue this pattern of prompting the user for a new oligo sequence and displaying its reverse complement until the user enters a sequence with at least one character that is invalid (i.e. a character other than A, C, G, or T). At this point, the program should end its run with a message that mentions that an invalid character was found, with no further prompting to the user.

Did you know that the reverse() function not only works on arrays, but also in a scalar context where it reverses the letters of a text string? Quite useful! For example:

my $text = "Larry Wall";

reverse($text);    # $text now contains "llaW yrraL"

Reference no: EM1389800

Questions Cloud

Eminent domain is a morally legitimate right of government : Do you believe that eminent domain is a morally legitimate right of government? Explain why or why not. Give examples of where the exercise of eminent domain has had positive effects
Elaboration on multiple statistics concepts : For this assignment employ the data below which was taken from the previous online class. Find out if the data is qualitative or quantitative, continuous or discrete, and determine the level of measurement.
Predict the ratios of phenotypes among the offspring : The genes for body color and wing size in Drosophila are on the same chromosome and forecast the ratios of the following phenotypes among the offspring,
Utilitarian view from a standpoint of economic distribution : Utilitarian view from the standpoint of economic distribution, worker partcipation (principles of political Economy). and greater equality of income.
Write a perl subroutine for temperature conversion : Write a perl subroutine for temperature conversion named 'convert_temp'. It should be able to handle both Fahrenheit to Celsius conversions as well as Celsius to Fahrenheit conversions.
Working with statistical terminology : A cereal manufacturer seeks to test their newest product against competitor's. A group of 100 children was asked to measure each brand, and then to express a preference.
American companies do more good by refusing to cooperte : Would American companies do more good by refusing to cooperte with Chinese authorities and risk not being able to do business in china
What is the average amount of safety stock : What is the average amount of safety stock for the reorder point in (a)? What are the total variable weekly costs including safety stock costs?
Explain the possible fates of dna : Explain the possible fates of DNA that in brought into the recipient cell during generalized transduction.

Reviews

Write a Review

 

PL-SQL Programming Questions & Answers

  Create program to enter first and second number

Create a program that enters first and a second number. The first and second number that will be entered should be computed in halves, quarter, double, and square.

  Write pl-sql block to display the last name of people

Write a PL/SQL block that displays the last name and salary of the following people. Each of these can be done separately as PL/SQL, first to test and get the output lines then encapsulated in the procedure.

  Write sql create table statement to create pet table

Write an SQL CREATE TABLE statement to create the PET table without referential integrity constraint on OwnerID in PET.

  Writing and execuinge sql command

The table name will be METALS and will be used to store description of various metals. Following offers some additional direction on how table must be created.

  Determine resonant frequency in series rlc resonant circuit

Given the series RLC resonant circuit in the figure, operating at variable frequency, determine: The resonant frequency ω o ,  The circuit’s quality factor Q , The cut-off frequencies, f 1  & f 2  and the bandwidth BW

  Write sql statement to create user defined function

Write SQL statement which creates user defined function which returns int value. This int return value is obtained by deducting the lowest Count field value from the highest Count field value of Part table.

  Design new transaction by sql statements

Code SQL statements to update view as follows: change spelling of Mark Tobey to Mark Toby. Design new Transaction for Mark Toby. Suppose you have essential transaction, work, and customer data.

  Describe the meaning of keyword exists and not exists

Describe the meaning of the keyword EXISTS. Describe how any and all relate to EXISTS and NOT EXISTS. Write a query which will display names of any customers who are interested in all artists.

  Convert requirement to logic and then to sql

Prepare the SQL query for each of given requirements. Convert requirement to logic, then to SQL. Illustrate the names of all products which have been sold.

  Write sql statement-display major of student-no duplications

Write a SQL statement to display the Major of the student with no duplications. Write a SQL statement to display the First and Last name of students who live in the Zip code 88888.

  What is an sql injection attack

What is an SQL injection attack? Explain how it works, and what precautions must be taken to prevent SQL injection attacks.What are two advantages of encrypting data stored in the database?

  Write sql statement to display first-last name of students

Write a SQL statement to display the First and Last name of students who have the Status greater than 1 and less than 10. Use BETWEEN.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd