Programming Theory

Programming theory deals with the design, implementation, analysis, characterization, and classification of programming languages and their individual features, along with introductory programming concepts like program structure, variable declaration and conditional and looping constructs. Sub-disciplines include the formal semantics of programming languages, type theory, program analysis and transformation, comparative programming language analysis, metaprogramming, domain-specific languages, compiler construction and run-time systems.

Share tech news, updates, or what's on your mind.

Sign up to Post

http://codingbat.com/prob/p128270
public int[] front11(int[] a, int[] b) {
 
  if (a.length==0) return new int[]{b[0]};
  if (b.length==0) return new int[]{a[0]};
   if ((a.length==0) && (b.length==0)) return new int[]{};
  return new int[]{a[0],b[0]};
}





public int[] front11(int[] a, int[] b) {
    if ((a.length==0) && (b.length==0)) return new int[]{};
  if (a.length==0) return new int[]{b[0]};
  if (b.length==0) return new int[]{a[0]};

  return new int[]{a[0],b[0]};
}




why first one fails below test with ArrayIndexOutOfBoundsException
Expected	Run		
front11([1, 2, 3], [7, 9, 8]) → [1, 7]	[1, 7]	OK	
front11([1], [2]) → [1, 2]	[1, 2]	OK	
front11([1, 7], []) → [1]	[1]	OK	
front11([], [2, 8]) → [2]	[2]	OK	
front11([], []) → []	ArrayIndexOutOfBoundsException: 0 (line:3)	X	
front11([3], [1, 4, 1, 9]) → [3, 1]	[3, 1]	OK	
front11([1, 4, 1, 9], []) → [1]	[1]	OK	
other tests
OK	
Correct for more than half the tests

Your progress graph for this problem

Open in new window


please advise
0
Get HTML5 Certified
LVL 9
Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

I have been reading about the Turing machine lately.  My question for you does the average laptop meet criteria for being a turing machine?  It works different, but I think it can do everything a turning machine can do.

Would you agree or disagree?

Thanks.
0
I did my main Part but i m unable to put the input/ output code.  I want to add one file and output file using array of structure and file I/O.  So i need help if any one can help me out with that codes. this my main part of code in this i want to add the file I/O part . with reading a file from the data and output to the console window. I have attached one .pdf file to the program i want to to that thing in this program. So i need your help.

#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

struct Weather
{
    double Temperature;
    double windSpeed;
    double dewPoint;
    double windChill;
    double cloudBase;
};

void get_input(double& tempF, double& windSpeed, double& dewPoint);
float get_windChill(double tempF, double windSpeed);
float get_cloudBase(double tempF, double dewPoint);
void show_output(double tempF, double dewPoint, double windSpeed, double windChill, double cloudBase);


int main()
{
   

    cout << "-----------------------------------------------------" << endl;
    cout << "This program determines wind chill using temperature" << endl;
    cout << "in Fahrenheit and wind speed in mph, and computes" << endl;
    cout << "the cloud base using the dew point in Fahrenheit" << endl;
    cout << "-----------------------------------------------------" << endl;


    double degreesFahrenheit, mph,dewPoint;
    float cloudBase, wc;

    get_input(degreesFahrenheit, mph, dewPoint);
    wc = get_windChill(degreesFahrenheit,

Open in new window

0
Hi All, I am creating a simple module using API.AI where API will ask set of 10 questions and retrieve answers.I In between of these question set i.e. after question 3, i want to handle in between user queries using other intent also but after handling those queries, I want to return back to the original question set i.e. question 4. Can we do this ? if not what is the suitable way of handling such scenario?
0
In API.AI, @system.given-name can recognize English names. I want to create a module for india. Do we have any method by which we can use such kind of concept for indian names?
0
What is counting semaphore?
0
I would like to know the approach one has to take to architect software product/solution. How to device a high level architecture for a product being built from scratch? Requirements: service oriented, scalable data integration (interoperability) solution.

Please share references that may help learn software architecture/design basics. I have very broad (not deep) technical background including software engineering with basic coding skills as well.

I am not trying to become an expert architect but want to know key factors, pitfalls etc  of 'modern' software architecture.
0
How to count input numbers in a little man computer program
e.g 25 45 63
that means 3 numbers...the output should be 3
i need the coding
thanks
0
Hello

I am trying to generate java files from WSDL using Apache CXF plugin in my maven, but when I do maven generate sources I neither get any error in the console nor there are any files generated
pom.xml
0

Programming Theory

Programming theory deals with the design, implementation, analysis, characterization, and classification of programming languages and their individual features, along with introductory programming concepts like program structure, variable declaration and conditional and looping constructs. Sub-disciplines include the formal semantics of programming languages, type theory, program analysis and transformation, comparative programming language analysis, metaprogramming, domain-specific languages, compiler construction and run-time systems.