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

  Write sql statement which creates stored procedure

Write SQL statement which creates stored procedure with one int input parameter. Stored procedure selects supplierId field and total of all Count field values for each group of supplierId's from Part table.

  Write down name of actors in ascending order

Write down actors (or actress, your choice, but not both) who have won at least two (2) Academy Awards for best actor/actress. Provide the actor name, movie title & year. Order the result by actor name."

  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.

  Sql questions

Write a query to display using the employees table the EMPLOYEE_ID, FIRST_NAME, LAST_NAME and HIRE_DATE of every employee who was hired after to 1 January, 1995.

  Write queries in sql if employee works on every project

Write the following queries in SQL: If an employee works on every project located in Houston, then list the employees social security number and name.

  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.

  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.

  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.

  Write statement which creates table named part

Write the statement which creates table named Part, with Id field as an int idendity PK, a SupplierId int field, a Description string field of size 25, a Count int field, a Class string field

  Query that uses cube operator to return lineitemsum

Write summary query which uses CUBE operator to return LineItemSum (which is the sum of InvoiceLineItemAmount) group by Account(an alias for AccountDesciption).

  Write a xquery which returns all concert titles

Write a XQuery which returns all concert titles whose type is chamber orchestra where average ticket price is at least $50.

  Provide four queries to answer questions asked by end users

Explain how you will go about developing this database. Provide at least four queries that answer some of the questions asked by the end users.

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