Write a perl subroutine for temperature conversion

Assignment Help PL-SQL Programming
Reference no: EM1383888

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: EM1383888

Questions Cloud

What communication concepts or theories could be used : What communication concepts or theories could be used to enhance communications through personal selling
Calculating volume of gas-block of dry ice : A 1-kg block of dry ice (solid CO 2 ) becomes a gas at room temperature. Calculate the volume of gas produced at 25 degrees celsius and 975 kPa.
Use one-dimensional array to solve problem : Use one-dimensional array to solve following problem. Read in 10 numbers, each of which is between 10 and 100 inclusive.
Determine culture and socialization : Provide some examples of how you used or how subtle positive or negative sanctions have been used on you to influence your behavior.
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.
Impact the organization and bring human resources : Is your supervisor correct in stating that reengineering the service processes can in fact impact the organization and bring human resources more in tune with the needs of the organization and its varying customers' needs?
Effects of socialization on gender : If you were asked to develop a "gender free" socialization model for a classroom or for your own home, what do you see as the major obstacles of implementing such a plan?
The channels of distribution are quite different : An important part of the service model is the distribution of supplementary services through physical or electronic channels of distribution. Within human resource management, the channels of distribution are quite different from traditional chann..
Personal sources of enculturation : Sources of enculturation might be mother, father, other significant care giver, specific siblings, specific relatives, specific friends, specific religious or educational figures

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  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 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 select statement to return those rows with due balance

Write SELECT statement which returns those rows with the balance due greater than 1000. Sort result set by InvoiceTotal, with largest invoice first.

  Create report to display scr courses in alphabetical order

Create the detail report which will display all SCR courses in alphabetical order, with a course name and instructor name in the group header.

  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 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

  Write sql statement to produce single column

Write an SQL statement to produce a single column called ItemLocation that combines the SKU_Description,the phrase "is located in."

  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.

  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

  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.

  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.

  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.

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