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
aleksley [76]
2 years ago
12

In the U.S. fuel efficiency of cars is specified in miles per gallon (mpg). In Europe it is often expressed in liters per 100 km

. Write a MATLAB user- defined function that converts fuel efficiency from mpg to liters per 100 km. For the function name and arguments, use Lkm-mpgToLpkm (mpg). The input argument mpg is the efficiency in mi/gl, and the output argument Lkm is the efficiency in liters per 100 km (rounded to the nearest hundredth). Use the function in the Command Window to:________.
(a) Determine the fuel eficiency in liters per 100 km of a car whose fuel effi- ciency is 21 mi/gal.
(b) Determine the fuel efficiency in liters per 100 km of a car whose fuel effi- ciency is 36 mi/gal.
Computers and Technology
1 answer:
timama [110]2 years ago
6 0

Answer and Explanation:

Using MATLAB code:

Function Lkm = Lkm-mpgToLpkm (mpg)

Lkm= mpg*1.60934/3.78541;

Lkm= Lkm^(-1);

Lkm= Lkm*100;

%the code above defines a function Lkm and takes argument/input to its parameter mpg(miles per gallon) and then returns/output Lkm which is the litres per kilometers conversion from miles per gallon input.

end

To call the function written above with argument 30 mpg, we write:

Lkm= Lkm-mpgToLpkm (30)

You might be interested in
SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Assume that the classes listed in the Java Quick R
Ne4ueva [31]

Answer:

Check the explanation

Explanation:

CODE:-

import java.util.*;

class UserName{

  ArrayList<String> possibleNames;

  UserName(String firstName, String lastName){

      if(this.isValidName(firstName) && this.isValidName(lastName)){

          possibleNames = new ArrayList<String>();

          for(int i=1;i<firstName.length()+1;i++){

              possibleNames.add(lastName+firstName.substring(0,i));

          }  

      }else{

          System.out.println("firstName and lastName must contain letters only.");

      }

  }

  public boolean isUsed(String name, String[] arr){

      for(int i=0;i<arr.length;i++){

          if(name.equals(arr[i]))

              return true;

      }

      return false;

  }

  public void setAvailableUserNames(String[] usedNames){

      String[] names = new String[this.possibleNames.size()];

      names = this.possibleNames.toArray(names);

      for(int i=0;i<usedNames.length;i++){

          if(isUsed(usedNames[i],names)){

              int index = this.possibleNames.indexOf(usedNames[i]);

              this.possibleNames.remove(index);

              names = new String[this.possibleNames.size()];

              names = this.possibleNames.toArray(names);

          }

      }

  }

  public boolean isValidName(String str){

      if(str.length()==0) return false;

      for(int i=0;i<str.length();i++){

          if(str.charAt(i)<'a'||str.charAt(i)>'z' && (str.charAt(i)<'A' || str.charAt(i)>'Z'))

              return false;

      }

      return true;

  }

  public static void main(String[] args) {

      UserName person1 = new UserName("john","smith");

      System.out.println(person1.possibleNames);

      String[] used = {"harta","hartm","harty"};

      UserName person2 = new UserName("mary","hart");

      System.out.println("possibleNames before removing: "+person2.possibleNames);

      person2.setAvailableUserNames(used);

      System.out.println("possibleNames after removing: "+person2.possibleNames);

  }

}

Kindly check the attached image below for the code output.

5 0
3 years ago
What approach to dealing with deadlock does the wait-for graphs implement (prevention/avoidance/detection/ recovery)?
V125BC [204]
"detection" by checking for possible cycles or knots.
3 0
3 years ago
Ms. Rogers wants to see the names of all the students who scored below 25 on the test. Which of these custom options will help h
photoshop1234 [79]
B Is less than because it says below

6 0
3 years ago
Describe how MICR is used to read these details from the cheque​
KatRina [158]

Answer:

A MICR device reading the magnetic ink on a cheque. (the ink contains iron particles). This special ink is used to write customer account numbers on the bottom of cheques. The MICR device reads the account numbers then converts it to a form the computer can understand.

Explanation:

A MICR device reading the magnetic ink on a cheque. (the ink contains iron particles). This special ink is used to write customer account numbers on the bottom of cheques. The MICR device reads the account numbers then converts it to a form the computer can understand.

7 0
3 years ago
4.2 Code Practice: Question 1<br> Can someone help me write the code in python language?
alekssr [168]

Answer:

number = int(input("Enter a number: "))

sum = number

c = 1

while (sum<=100):

   number = int(input("Enter a number: "))

   sum = sum + number

   c = c + 1

print("Sum: " + str(sum))

print("Numbers Entered: " + str(c))

Explanation:

Hope this helps lovely :)

8 0
2 years ago
Other questions:
  • Designing the moving parts of a car—including the engine, drivetrain, steering, and brakes—is done by what type of engineer?
    11·2 answers
  • Ruby is creating a presentation. She wants each slide displayed at intervals of five seconds. Which feature in the presentation
    6·2 answers
  • Writing anything that comes to mind that may relate to your personal essay is called:
    15·2 answers
  • Consider the following partial class definitions: public class A1 { public int x; private int y; protected int z; ... } public c
    12·1 answer
  • If my_string = "This is MY string!", why does print (my_string[0:7:5]) return "Ti" and not
    11·1 answer
  • What data discovery process, whereby objects are categorized into predetermined groups, is used in text mining?
    9·1 answer
  • Write an assembly program that will prompt the user for 3 inputs (let’s abstractly call them a, b, and c) without a leading stri
    13·1 answer
  • Write a pseudocode for the logic of a program that accepts five numbers from a user and displays one of the following messages:-
    8·1 answer
  • Online platforms that allow users to represent themselves via a profile on a web site and provide and receive links to other net
    11·1 answer
  • Lots of Ways to Use Math.random() in JavaScript
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!