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

  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.

  Write sql statement to create stored procedure

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

  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 sql commands to implement profile

Write SQL commands which would implement this profile. Next, write query that would list profile, profile resource name, and limit value for the new profile.

  Write down sql needed to create employee table

Write down SQL needed to create employee table containing the following data: employeeID, text, length of 5, primary key lastName, text, length of 25

  Write pl-sql block that displays last name

Write PL/SQL block which displays last name and salary of following people. Each of these can be done separately as PL/SQL, first to test and get output lines.

  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.

  Sql query into a relational algebra statement

Turn this SQL query into a relational algebra statement? SELECT Request.reqfor, Ordering.invamt, Ordering.invnbr, Ordering.invdat

  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.

  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

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

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