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
Serggg [28]
3 years ago
12

Part of the following pseudocode is incompatible with the Java, Python, C, and C++ language Identify the problem. How would you

fix the problem if you were to translate theis pseudocode into one of the aforementioned languages?. Module checkEquality(Integer num1, Integer num2)
If num1 = num2 Then

Display *The values are equal.*

Else

Display *The values are Not equal.*

End if

End Module
Engineering
1 answer:
hammer [34]3 years ago
4 0

Answer:

The main problem is the incorrect use of assignment operator, the correct way to check if two number are equal is

num1==num2

Explanation:

Here we have a created a simple function which takes two input arguments num1 and num2. In the body of the function we have used if condition to find out whether the two number are equal or not. If condition is true then print that values are equal. If condition is false then print that values are not equal. In the driver code, we have called the function two times with different values of num1 and num2 to check if it is working correctly.

The implementation logic is same in all these programming languages, the only difference the syntax.

Python Code:

def checkEquality(num1, num2):

   if num1 == num2:

       print("The values are equal.")

   else:

       print("The values are not equal.")

Driver Code:

checkEquality(2,5)

checkEquality(3,3)

Output:

The values are not equal.

The values are equal.

C++ Code:

void checkEquality(int num1, int num2) {

   if (num1 == num2)

       cout<<"The values are equal."<<endl;

   else

       cout<<"The values are not equal."<<endl;

}

Driver Code:

#include <iostream>

using namespace std;

void checkEquality(int num1, int num2);

int main()

{

checkEquality(2,5);

checkEquality(3,3);

return 0;

}

Output:

The values are not equal.

The values are equal.

You might be interested in
Given the inherent costs of regulation it is safe to say that there is always a negative economic impact associated with regulat
Alexus [3.1K]

the answer is true.                                     <u>                    </u>                                                              

6 0
2 years ago
Vending machine controller (adapted from Katz, "Contemporary Logic Design") Design and implement a finite state machine that con
babunello [35]

Answer:

Check the explanation

Explanation:

A vending machine controller is that type of machine that comes with a single serial port on the same chip as the programmable processor. The controller comprises of a port arbitrator that selectively attaches or links one of a number of serially communicating devices to this single serial port.

Kindly check the attached image to get the step by step explanation to the above question.

6 0
3 years ago
(a) Draw the Moore finite state machine (FSM) of an electronic combination lock with a RESET button, two number buttons (0 and 1
Dafna11 [192]

Answer:

Explanation:

There are a total of 6 states and 3 bits in this problem. Whenever the Reset button is pressed, RESET state is called otherwise the state according to the diagram is called. For the combination to be "01011", the input sequence has to be in the same order. If 0 is pressed instead of 1 in state "010", the last state of output ending with 0 will be called and likewise in all the states that follow.

7 0
3 years ago
Create a program named PaintingDemo that instantiates an array of eight Room objects and demonstrates the Room methods. The Room
Serggg [28]

Answer:

Explanation:

Code used will be like

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace PaintingWall

{

class Room

{

public int length, width, height,Area,Gallons;

public Room(int l,int w,int h)

{

length = l;

width = w;

height = h;  

}

private int getLength()

{

return length;

}

private int getWidth()

{

return width;

}

private int getHeight()

{

return height;

}

public void WallAreaAndNumberGallons()

{

Area = getLength() * getHeight() * getWidth();

if (Area < 350)

{

Gallons = 1;

}

else if (Area > 350)

{

Gallons = 2;

}    

Console.WriteLine ("The area of the Room is " + Area);

Console.WriteLine("The number of gallons paint needed to paint the Room is " + Gallons);

}

 

}

class PaintingDemo

{

static void Main(string[] args)

{

int l, w, h;

Room[] r = new Room[8];

for (int i = 0; i <= 7; i++)

{

Console.WriteLine("Room "+(i+1));

Console.Write("Enter Length : ");

l = Convert.ToInt32(Console.ReadLine() );

Console.Write("Enter Width : ");

w = Convert.ToInt32(Console.ReadLine());

Console.Write("Enter Height : ");

h= Convert.ToInt32(Console.ReadLine());

r[i] = new Room(l,w,h);

Console.WriteLine();

}

for (int i = 0; i <= 7; i++)

{

Console.WriteLine("Room " + (i + 1));

r[i].WallAreaAndNumberGallons();

}

Console.ReadKey();  

}

}

}

3 0
3 years ago
If a lever operates at a mechanical disadvantage, it means that the ________.
alekssr [168]

Answer:

The correct answer is option 'B': Load is far from fulcrum and the effort is applied near the fulcrum

Explanation:

A lever works on the principle of balancing of torques. The torque about the fulcrum by the load should be equal to the torque by the applied effort. Since we know that the torque is proportional to both the force and the distance it is applied from the distance from the axis of rotation. A lever is used when we need to lift a heavy load by utilizing this effect of the lever arm.

A mechanical disadvantage occurs when we are not able to lift the weight easily due to the fact we apply effort near the fulcrum.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Laws that protect businesses involve
    10·1 answer
  • Plz answer all of these questions!
    15·1 answer
  • Print reading for industry unit 9 review questions
    6·2 answers
  • 100 kg of refrigerant-134a at 200 kPa iscontained in a piston-cylinder device whose volume is 12.322 m3. The piston is now moved
    14·1 answer
  • A belt drive was designed to transmit the power of P=7.5 kW with the velocity v=10m/s. The tensile load of the tight side is twi
    14·1 answer
  • You are using a Geiger counter to measure the activity of a radioactive substance over the course of several minutes. If the rea
    8·1 answer
  • (4 points) What field of work generally requires (a) an engineer to have a Professional Engineer
    11·1 answer
  • Special certification is required for technicians who handle which of the following systems?
    10·1 answer
  • In surveying , supposing we can not pull the tape because it is passing through a shallow river. What will i do to obtain an acc
    11·1 answer
  • Javier’s class visited a power plant near his city, and they learned how it produced electricity. What does this form of power d
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!