Question

In: Computer Science

Please write code in SCALA Thanks in advance Use curried representation and write system which convert...

Please write code in SCALA
Thanks in advance


Use curried representation and write system which
convert pressure units.
Input: pressure in atm (atmosphere) Outputs: PSI, bar, torr
1 atm = 14.6956 psi = 760 torr = 101325 Pa = 1.01325 bar.

Solutions

Expert Solution


object MyClass {
    def main(args: Array[String]) {
        
        // reading float value
        var atm = scala.io.StdIn.readFloat()
        
        // convertion of pressure to other units
        var psi = atm * 14.6956
        var torr = atm * 760
        var pascal = atm * 101325
        var bar = atm * 1.01325
        
        // printing pressure
        println("Pressure          : " + atm + " ATM")
        println("Convert To PSI    : " + psi + " PSI")
        println("Convert To Torr   : " + torr + " Torr")
        println("Convert To Pascal : " + pascal + " Pascal")
        println("Convert To Bar    : " + bar + " Bar")
        
    }
}

Code

Output


Related Solutions

Please give a detailed explanation, not just the answer. Thanks in advance! Use the data in...
Please give a detailed explanation, not just the answer. Thanks in advance! Use the data in the given table to fill in the missing coefficients. Round your answers to 3 decimal places. x y 2 13.524 7.5 19.125 13 23.463 18.5 28.937 24 33.6 29.5 37.779 35 43.065 y=_____x +_______
please write about stakeholders approach in 200 words. thanks in advance. the topic is ''stakeholders approach''.
please write about stakeholders approach in 200 words. thanks in advance. the topic is ''stakeholders approach''.
USE C++ PLEASE AND EXPLAIN LINES AS MUCH AS POSSIBLE...THANKS IN ADVANCE...NEED THIS ASAP An unknown...
USE C++ PLEASE AND EXPLAIN LINES AS MUCH AS POSSIBLE...THANKS IN ADVANCE...NEED THIS ASAP An unknown number of grades as integers, but no more than 30, are to be read from the file grades.dat. You may assume each grade will be a valid value between 0 and 100 (no validation necessary) and all "grades" are out of a maximum 100 points. Output the Number of Grades read in from the file. Calculate and output the Total Points Earned. Calculate and...
please write the java code so it can run on jGRASP Thanks! CODE 1 1 /**...
please write the java code so it can run on jGRASP Thanks! CODE 1 1 /** 2 * SameArray2.java 3 * @author Sherri Vaseashta4 * @version1 5 * @see 6 */ 7 import java.util.Scanner;8 public class SameArray29{ 10 public static void main(String[] args) 11 { 12 int[] array1 = {2, 4, 6, 8, 10}; 13 int[] array2 = new int[5]; //initializing array2 14 15 //copies the content of array1 and array2 16 for (int arrayCounter = 0; arrayCounter < 5;...
Please answer the questions as soon as possible. Thanks in advance. Please explain in brief in...
Please answer the questions as soon as possible. Thanks in advance. Please explain in brief in one to two paragraphs and provide graphs. 1. In two paragraphs, describe the sources of the gains from trade and why countries use import tariffs. 2b In two paragraphs, describe how the COVID-19 pandemic has impacted the global macroeconomy and multiple ways it has impacted a specific agricultural commodity market (e.g. corn, beef, wheat).
PLEASE WRITE IN C++ PROGRAM THANKS - QUEUES Please study the code posted below. Please rewrite...
PLEASE WRITE IN C++ PROGRAM THANKS - QUEUES Please study the code posted below. Please rewrite the code implementing a template class using a linked list instead of an array. Note: The functionality should remain the same /** * Queue implementation using linked list C style implementation ( no OOP). */ #include <cstdio> #include <cstdlib> #include <climits> #include <iostream> #define CAPACITY 100 // Queue max capacity using namespace std; /** Queue structure definition */ struct QueueType { int data; struct...
Please write code in java and comment . thanks Item class A constructor, with a String...
Please write code in java and comment . thanks Item class A constructor, with a String parameter representing the name of the item. A name() method and a toString() method, both of which are identical and which return the name of the item. BadAmountException Class It must be a RuntimeException. A RuntimeException is a subclass of Exception which has the special property that we wouldn't need to declare it if we need to use it. It must have a default...
please write the java code so it can run on jGRASP Thanks! 1 /** 2 *...
please write the java code so it can run on jGRASP Thanks! 1 /** 2 * PassArray 3 * @Sherri Vaseashta 4 * @Version 1 5 * @see 6 */ 7 import java.util.Scanner; 8 9 /** 10 This program demonstrates passing an array 11 as an argument to a method 12 */13 14 public class PassArray 15 { 16 public static void main(String[] args) 17 { 18 19 final int ARRAY_SIZE = 4; //Size of the array 20 // Create...
I need the code for following in C++ working for Visual studio please. Thanks Use a...
I need the code for following in C++ working for Visual studio please. Thanks Use a Struct to create a structure for a Player. The Player will have the following data that it needs maintain: Struct Player int health int level string playerName double gameComplete bool isGodMode Create the 2 functions that will do the following: 1) initialize(string aPlayerName) which takes in a playername string and creates a Player struct health= 100 level= 1 playerName = aPlayerName gameComplete = 0...
Plz convert this C++ code into JAVA code thanks #include<iostream> using namespace std; //function for calculating...
Plz convert this C++ code into JAVA code thanks #include<iostream> using namespace std; //function for calculating the average sightings from the Total Sightings array float calcAverage(float totalSightings[],int n) {    int i;    float sum=0.0;    for(i=0;i<n;i++)    sum=sum+totalSightings[i];    return sum/n; } int main() {    // n is no. of bird watchers    //flag , flag2 and flag3 are for validating using while loops    int n,i,flag,flag2,flag3;       //ch also helps in validating    char ch;   ...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT