In Ruby Programming,
Regarding the following code:
puts “Enter your state abbreviation”
my_state = gets
if(my_state = “MI”)
puts “Michigan!”
end
There are two problems with this code. What are they and what must be done to fix them?
Answer: here is the answer for your question :
RUBY CORRECT CODE
----------------------------------------------------------------------------------------------------------------------------------------------
print "Enter your state abbreviation"
my_state = gets
if my_state == "MI"
puts "Michigan!"
end
----------------------------------------------------------------------------------------------------------------------------------------------
CODE OUTPUT AND SNIPPET:


I hope this would help you out
If you have any doubt, you can provide comment /feedback below the answer
Thanks
In Ruby Programming, Regarding the following code: puts “Enter your state abbreviation” my_state = gets if(my_state...
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 company in Australia. You currently have the cost in US dollars and need to convert the prices to the Australian dollar. Write a 2-part program using Ruby, Java, or Python. Part 1: Write a function to gather the following costs from...
Can someone verify the programming code below for visual studio code python. Stores your first name as a variable. Use all lowercase letters when you declare it. Stores your last name as a variable. Use all uppercase letters when you declare it. Prints out, "Hello, <first name> <last name>" with the first name converted to uppercase letters and the last name converted to lowercase letters using string functions. Prints out two newlines. Prints out the following: "Start by doing what's...
Hi please help with c++ programming.
This is my code. there's a syntax error. PLEASE FIX MY CODE
instead of re-designing the program.
Thanks
/*
Description of problem:
Introduction to Friends functions.
Create objects in the stack (not on the heap)
3.1: Add a friend function, kilotopound, which will convert
kilograms to pounds.
3.2: Add a copy constructor utilizing Lab 3.1 code.
Copy the fist object using a copy constructor. Output the contents
of both objects.
*/
#include <iostream>...
C programming Rewrite the following code replacing the else-if construct with a switch statement. Make sure you test your code. Supplied code #include <stdio.h> int main(void) { char ch; int countA = 0; int countE = 0; int countI = 0; printf("Enter in a letter A, E, or I.\n"); scanf(" %c", &ch); //Replace the following block with your switch if(ch == 'E' || ch == 'e') countE++; else if(ch == 'A' || ch == 'a') countA++; else if(ch == 'I'...
1/3
2/3
3/3
This programming assignment involves adding functionality to the SearchTreeset implementation found in the SetMap project. Specifically you will edit the file util.SearchTreeSet and write Java-correct implementations of these methods * first pollFirst headset e lower The goal is to make these methods behave exactly like they would for a Java Treeset. Additional programming requirements the first, pollFirst, and lower methods should just take one or two passes down the tree. For a "well-balanced" tree, the time should...
Java programming: The following java code is supposed to solve a linear equation of the form aX+b = 0 where a and b are real numbers. However, there are some errors, nd and x them using a combination of exceptions and control statements. Hint. What could go wrong in the execution of this program? /*********************************************/ // here is the code I have: import java.util.*; public class Solver{ public static void main(String[] args){ System.out.println("Let us solve an equation of the form...
write a C programming code for the following prompt. please
use stucture concept and test if the code works perfectly.
Project Description: In this project, you will write a program to calculate the roots of a quadratic equation. Structure concepts will be used in this project. Your program will prompt the user to enter the coefficients of a quadra coefficientsType. Then it will compute the roots of the quadratic equation and store the result in a structure variable of type...
3 Programming Question (45 points) 3.1 Instructions You need to write the code by yourself. Your implementation must use C/C++ and your code must run on the Linux machine general.asu.edu. Please refer to the programming guide (available under the Assignments folder on Blackboard) for using the general.asu.edu server, as well as compiling and running C/C++ code under Linux For this question, you need to provide a Makefile that compiles your program to an executable named a3 that runs on the...
Data Programming l: PYTHON 1. Write a program that computes your gross pay. Your code should get two numbers: hours and rate per hour. You should give the employee 1.75 times the hourly rate for hours worked above 40 hours. Output: Your gross pay is $487.5 2. Rewrite the previous program using try and except so that your program handles non-numeric inputs gracefully by printing a message and exiting the program. The following shows two executions of the program with...
Write code in R or Rstudio (Programming) You track your commute times for three weeks (15 days), recording the following times in minutes: 17, 16, 20, 24, 22, 15, 21, 25, 17, 90, 16, 17, 22, 20, 20. Enter the data into a 3-by-5 matrix, where rows are weeks and columns are weekdays. Please answer the following questions and provide the necessary code. (a) Name each column with the weekday abbreviations, i.e., Mon, Tue, Wed, Thu, and Fri (b) Find...