Question

I need help with this problem please, This code needs to be in Ruby, Java, or Python. See problem below.

-5 - Functional Programming (due Mon] Assignment Content Your software company was invited to provide a proposal for a compan

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE :

import java.util.Scanner; //to get input from keyboard
class Main
{
/*************** DECLARE THE VARIABLES ***************/
   public static float travel,hotel,rental,labor;
/*************** GET COSTS (USD) PART 1 ***************/
   public void get_amount()
   {
       //the program will keep on asking for the input unless a non-negative value is inserted
      
       Scanner sc = new Scanner(System.in);
       while(1)
       {
           System.out.print("Enter the Travel Cost (USD) : ");
           travel = sc.nextFloat();
           if(travel>=0)
               break;
       }
       while(1)
       {
           System.out.print("Enter the Hotel Cost (USD) : ");
           hotel = sc.nextFloat();
           if(hotel>=0)
               break;
       }
       while(1)
       {
           System.out.print("Enter the Rental Car Cost (USD) : ");
           rental = sc.nextFloat();
           if(rental>=0)
               break;
       }
       while (1)
       {
           System.out.print("Enter the Labor Cost (USD) : ");
           labor = sc.nextFloat();
           if(labor>=0)
               break;
       }
      
   }
/*************** CALCULATE COSTS (AUD) PART 2 ***************/
   public void get_aud()
   {
       //the conversion rate of USD to AUD as of 18th Feb 2020 is 1.49 AUD per USD
       float conversion = (float)1.49;
       travel = travel*conversion;
       hotel = hotel*conversion;
       rental = rental*conversion;
       labor = labor*conversion;
   }
   public static void main(String args[])//DRIVER CODE
   {
       Main m = new Main();
       m.get_amount();
       m.get_aud();
       System.out.println("Travel Cost (AUD) = " + travel);
       System.out.println("Hotel Cost (AUD) = " + hotel);
       System.out.println("Rental Car Cost (AUD) = " + rental);
       System.out.println("Labor Cost (AUD) = " + labor);
   }
}

OUTPUT:

E:\code>java Main Enter the Travel Cost (USD) : 500 Enter the Hotel Cost (USD) : 699 Enter the Rental Car Cost (USD) : 700 En

Add a comment
Know the answer?
Add Answer to:
I need help with this problem please, This code needs to be in Ruby, Java, or...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You recently graduated college and you are applying for a programming job that requires the understanding...

    You recently graduated college and you are applying for a programming job that requires the understanding of loops in Python. The manager you are interviewing with has asked you to take an assessment to prove your programming knowledge. Below are the requirements for the programming skills test. In Python, create a program that meets the following requirements: Take two integers from the user. Save the lower number as x. Save the largest integer as y. Write a loop that counts...

  • You recently graduated college and you are applying for a programming job that requires the understanding...

    You recently graduated college and you are applying for a programming job that requires the understanding of loops in Python. The manager you are interviewing with has asked you to take an assessment to prove your programming knowledge. Below are the requirements for the programming skills test. In Python, create a program that meets the following requirements: Take two integers from the user. Save the lower number as x. Save the largest integer as y. Write a loop that counts...

  • I need this in Net beans and not Python. Part 1 - Pseudo-code Design and write...

    I need this in Net beans and not Python. Part 1 - Pseudo-code Design and write the pseudo-code for the following Problem Statement. Problem Statement A company gives its employees an that will provide one of 3 results based on the following ranges of scores: Score Message on Report 90-100 Special Commendation 70-89 Pass Below 70 Fail Design a single If-Then-Else structure using pseudo-code which displays one of these messages based a score input by a user. Be sure your...

  • Java code. Need help with either 1. or 2. Nothing too complicated and the code needs...

    Java code. Need help with either 1. or 2. Nothing too complicated and the code needs at least one loop and 3 switch statements! Artificial Intelligence elements in programming. Creating stories with user input. For this assignment, you can do one of two things 1. Create a chat box that allows a conversation to go on as long as the user wants . Welcome the user when they start. . look for key words or other things that could guide...

  • please write code in java language and do not add any break, continue or goto statements...

    please write code in java language and do not add any break, continue or goto statements Write a program with a graphical interface that allows the user to convert an amount of money between U.S. dollars (USD), euros (EUR), and British pounds (GBP). The user interface should have the following elements: a text box to enter the amount to be converted, two combo boxes to allow the user to select the currencies, a button to make the conversion, and a...

  • write programs with detailed instructions on how to execute. code is java What you need to...

    write programs with detailed instructions on how to execute. code is java What you need to turn in: You will need to include an electronic copy of your report (standalone) and source code (zipped) of your programs. All programming files (source code) must be put in a zipped folder named "labl-name," where "name" is your last name. Submit the zipped folder on the assignment page in Canvas; submit the report separately (not inside the zipped folder) as a Microsoft Word...

  • PYTHON PLEASE Write a function to censor words from a sentence code: def censor_words(sentence, list_of_words): """...

    PYTHON PLEASE Write a function to censor words from a sentence code: def censor_words(sentence, list_of_words): """ The function takes a sentence and a list of words as input. The output is the sentence after censoring all the matching words in the sentence. Censoring is done by replacing each character in the censored word with a * sign. For example, the sentence "hello yes no", if we censor the word yes, will become "hello *** no" Note: do not censor the...

  • I need help in creating a testcode for this pseudocode in Java. For following questions, please...

    I need help in creating a testcode for this pseudocode in Java. For following questions, please provided your solutions for each of the questions ina separate Word document. 1. Write pseudocode for the following problem: (10 points) You are in charge of the school's IT department and several classes are asking to by iPads for use in their classes. Based on the number ofiPads each class requested, determine the total costs for each classroom. The only information given is that...

  • PYTHON Programming Exercise 2: Create a Simple Cost Calculator Write a program that displays input fields...

    PYTHON Programming Exercise 2: Create a Simple Cost Calculator Write a program that displays input fields (item name and cost) and calculates and displays the calculated costs. The program should do the following: Provide data entry areas for item name and cost. Calculate and display the subtotal of all items. Adds a sales tax of 6% and calculate and displays the total cost. Enter the following values into your program. Mother Board $200. RAM $75. Hard Drive $72. Video Graphics...

  • PLEASE HELP!!!I need help with the following JAVA PROGRAMS. Please ready carefully. So this comes from...

    PLEASE HELP!!!I need help with the following JAVA PROGRAMS. Please ready carefully. So this comes from tony gaddis starting out with java book. I have included the screenshot of the problems for reference. I need HELP implementing these two problems TOGETHER. There should be TWO class files. One which has TWO methods (one to implement problem 8, and one to implement problem 9). The second class should consist of the MAIN program with the MAIN method which calls those methods....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT