Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement examples of naming variables, functions, and classes using RUBY LANGUA

ID: 3838814 • Letter: I

Question

Implement examples of naming variables, functions, and classes using RUBY LANGUAGE.

Your program must include examples of:
1. global variable(s)
2. function(s) - show how local, nonlocal, and global variables can work together
3. class(es) -
  a. some fields.
  b. some methods
  
Your program must use all of the above examples.
You must write your program in 3 different languages.
One language must have a complete working and tested implementation,
while the other two should be as close to working as you can make
them.

MY DESCRIPTION:

This program I should tell me the

amount of pie left (in fraction)

after a certain amount has been taken off.

Use a fraction that has numerator and denominator

DESIGN:

              I will have a class called Fraction

              contains integers numerator and numerator

              that will call a function gcd

Another function called simplify that lowers

              the fraction into simplest form by calling the gcd

to determine the gcd of the denominator.

              a function called add fraction subtracts the amount

              taken off and return the answer as the remainder of pie I have left.

Explanation / Answer

Your descripttion is not clear enough , since the questions says that we need to demonstarte the use of classes,function, variables , i will try to do it in JAVA, C++, Python.

Lets do the code in C++ which uses classes, function etc

Now, lets code in Python:

class MyClass:

# this is global variable
variable = "blah"

# this is function defined in class

def function(self):
print("This is a message inside the class.")

myobjectx = MyClass()

myobjectx.variable

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote