1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andreas93 [3]
4 years ago
9

Write a program that includes functions to calculate feet to inches, inches to feet, feet to yards, and yards to feet. Then, acc

ept input from the user to test these functions.

Computers and Technology
2 answers:
RoseWind [281]4 years ago
7 0

Answer:

The program with all the functions implemented in Java programming language is given in the explanation section

Explanation:

import java.util.Scanner;

public class num11 {

   public static double feetToInches(double feet){

       return feet*12;

   }

   public static double inchesToFeet(double inches){

       return inches/12;

   }

   public static double feetToYard(double feet){

       return feet/3;

   }

   public static double yardToFeet(double yard){

       return yard*3;

   }

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter length in feet");

       double lenFeet = in.nextDouble();

       System.out.println("The equivalent in Inches is "+feetToInches(lenFeet));

       System.out.println("The equivalent in yard is "+feetToYard(lenFeet));

       System.out.println("enter value in Inches");

       double lenInches = in.nextDouble();

       System.out.println("The equivalent feet is "+inchesToFeet(lenInches));

       System.out.println("enter value in Yards");

       double lenYard = in.nextDouble();

       System.out.println("The equivalent feet is "+yardToFeet(lenYard));

   }

}

Montano1993 [528]4 years ago
6 0

Explanation:

One line simple functions are created. The four functions ft2inc, inc2ft, ft2yd, and yd2ft convert feet to inches, inches to feet, feet to yards, and yards to feet respectively. Then in the test code, input is taken from the user and each function is called one by one. eval is used to ensure numeric input from the user. The program is tested multiple times and it returns correct results.

Python Functions:

def ft2inc(ft):

   return print("Feet to Inches: ",ft*12)

def inc2ft(inc):

   return print("Inches to Feet: ",inc/12)

def ft2yd(ft):

   return print("Feet to Yards: ",ft/3)

def yd2ft(yd):

   return print("Yards to Feet: ",yd*3)

Test Code:

ft=eval(input("Conversion Feet to Inches: "))

ft2inc(ft)

inc=eval(input("Conversion Inches to Feet: "))

inc2ft(inc)

ft=eval(input("Conversion Feet to Yards: "))

ft2yd(ft)

yd=eval(input("Conversion Yards to Feet: "))

yd2ft(yd)

Output:

Conversion Feet to Inches: 2

Feet to Inches: 24

Conversion Inches to Feet: 48

Inches to Feet: 4.0

Conversion Feet to Yards: 9

Feet to Yards: 3.0

Conversion Yards to Feet: 12

Yards to Feet: 36

You might be interested in
You need to install an RODC in a new branch office and want to use an existing workgroup server running Windows Server 2012 R2.
klio [65]

Answer:

You should do the following:

  • Create an account of computer for RODC in the domain controller OU (Organizational unit) as well as allow the Micheal's account to join the computer to the domain.

Explanation:

RODC:

It is called as Read only domain controller that is used to ensure the protection of the servers at remote offices of an organizations.

  • In this case, you are installing an RODC in a new branch office that is remote. For installation of RODC on windows server 2012 R2, we need to create an account for the computer in the domain controller organizational unit for the installation of RODC.
  • We also need to create an account for Micheal's with the privilege to join that computer to the domain.

5 0
3 years ago
Choose the 3 Points in good story telling
Sidana [21]

Answer:

1.Choose a clear central message 2. Embrace conflict 3.Have a clear structure  

Explanation:

8 0
2 years ago
Create class SavingsAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders.
emmasim [6.3K]

Answer:

Class SavingsAccount( ):

annual_interest_rate

def.__init__(self, savings_balance):

self.savingsBalance = savings_balance

def calculatMonthlyInterest( ):

self.savingsBalance += (self.savingsBalance * annual_interest_rate) /12

return self.savingsBalance

def setInterestRate_(self, value):

self.annual_interest_rate = value

Explanation:

The python class above is used to create a savings account data for a customer, with methods to change the static interest rate and to calculate the monthly interest rate.

8 0
4 years ago
3. What is the value of a 4-band resistor which has the first band - Green, the
qwelly [4]

Answer:

56000 with a tolerance of 5%

Explanation:

5 6 + 3 zeros

3 is orange so that means you add 3 zeros when the orange band is present in the third position.

Green is 5

Blue is 6

Gold in the 4th band is the % tolerance. Gold is a 5% tolerance which mean that the real value is 5% either side of 56000/

The answer is B

4 0
3 years ago
In the code that follows, prompt is a/an ____________________________.
Delvig [45]
Var<span> person = prompt(</span>"Please enter your name"<span>, </span>"Name Field"<span>);
<span>Though, this might be in the wrong context.</span></span>
3 0
4 years ago
Other questions:
  • Which sector provides scope for multimedia designers?
    10·1 answer
  • If you delete a view, account administrators can recover the view using the "trash can" function within how many days?
    7·2 answers
  • Which form of malware contains hidden code that is triggered by meeting or reaching a specific condition? (A) Trap door (B) Viru
    12·1 answer
  • What is the term for a server at the highest level of the Domain Name System (DNS)?
    15·1 answer
  • Who like fortnite??????
    12·2 answers
  • .doc What is the difference between a skilled hacker and an unskilled hacker, other than skill levels? How does the protection a
    5·1 answer
  • The vertical and horizontal scroll bars can be used to aid in navigation throughout the document. true or false
    7·2 answers
  • When adopting and implementing a Software as a Service (SaaS) platform such as Salesforce for your business, which responsibilit
    7·1 answer
  • What method do phishing and spoofing scammers use
    12·1 answer
  • Can you please help me?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!