mekonahlogo-5

C++ | CSS | HTML | Javascript | Java | Python | Home

 

Welcome to mekonah.com where we try to encorge everyone to write code everyday, so once a day I will post a new program with varing skill levels and langauges which you can try for yourself.

For novice and newcomers who are unfimilar with the langauges, you will be able to find walkthroughs and guides on how to set up the enviroment and begin coding by clicking on any of the links at the top.

Distance Over Time Source Code

C++ logo

//
//  main.cpp
// 

#include <iostream>
#include <math.h>
#include <cmath>
using namespace std;
 
int main()
{
    double movtime;
    double Acceleration;
    double distance;
 

    cout << "Please input time (in seconds)";
    cin >> movtime;

    cout << "Please input acceleration (in feet)";
    cin >> Acceleration;

    if(movtime >= 0){
        distance = (Acceleration * (pow(movtime , 2.0) ))/ 2;

        cout<<"this is how far the object fell " <<distance<< " ft" << endl; 
    }
    return 0;
}

Basic Calculator

webmodellogos

<html>
    <head>
        <title>
Calculator</title>
        
        <script>
        
            function Add(){
                var num1 = document.getElementById('numeone').value;
                var num2 = document.getElementById('numtwo').value;
                var num3 = +num1 + +num2;
                
                document.getElementById("result").innerHTML = num3; 
            }
        
            function Subtract(){
                var num1 = document.getElementById('numeone').value;
                var num2 = document.getElementById('numtwo').value;
                var num3 = num1 – num2;
                
                document.getElementById("result").innerHTML = num3; 
            }
            
            function Multiply(){
                var num1 = document.getElementById('numeone').value;
                var num2 = document.getElementById('numtwo').value;
                var num3 = num1 * num2;
                
                document.getElementById("result").innerHTML = num3; 
            }
            
            function Divide(){                
                var num1 = document.getElementById('numeone').value;
                var num2 = document.getElementById('numtwo').value;                
                var num3 = num1 / num2;
                
                document.getElementById("result").innerHTML = num3;            
            }
               
        </script>
        
    </head>
    <body>

        <h1>Calculator</h1>
        <input id="numeone" type="text" name="numone"><br>
        <input id="numtwo" type="text" name="numtwo"><br>
        <h1 id="result"></h1><br>
        <div id="operator" style="display: inline-block; height: 50px; width: 50px; background-color: #80CCFF;" onclick="Add()"><h1>+</h1></div>
        <div id="operator" style="display: inline-block; height: 50px; width: 50px; background-color: #80CCFF;" onclick="Subtract()"><h1></h1></div>
        <div id="operator" style="display: inline-block; height: 50px; width: 50px; background-color: #80CCFF;" onclick="Multiply()"><h1>*</h1></div>
        <div id="operator" style="display: inline-block; height: 50px; width: 50px; background-color: #80CCFF;" onclick="Divide()"><h1>/</h1></div>
    </body>

</html>

Semi Palindrome Source Code

java-logo

import java.util.*;
 
class Palindrome
{
   public static void main(String args[])
   {
      String original, reverse = "";
      Scanner in = new Scanner(System.in);
      int n = 0;
 
      System.out.println("Enter a string to check if it is a palindrome");
      original = in.nextLine();
 
      int length = original.length();
 
      for ( int i = length 1; i >= 0; i)
        reverse = reverse + original.charAt(i);
      
      if (original.equals(reverse))
         System.out.println("Entered string is a palindrome.");
      
      else{
          for( int i = 0; i < length; i++){
              
              if(original.charAt(i) == reverse.charAt(i)){
                  n = n + 0;
              }
              else{
                  n = n + 1;
              }
              
            
          }
         System.out.println("Is not a palindromic " + n/2 + " semi-palindromic.");  
         
     }
   }
}    

Mekonah.com Greetings Code

python-logo

first_name = raw_input("What is your first name (Press Enter): ")
last_name = raw_input("What is your last name (Press Enter): ")

print "Hello", first_name, last_name

def question():
    question = raw_input("Do you like to code yes or no? ")
    check_out_site(question.lower())

def check_out_site(input):
    
    if(input == "yes"):
        print "That is awesome mekonah.com is the site for you"

    elif(input == "no"):
        print "Well still check out mekonah.com and hopefully we can change that"

    else:
        print "your input was not recognized please try again"
        question()
    
question()