Explore BrainMass
Share

Difference between the two codes listed below

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Details: Coding style is a very important characteristic for those entering the technology field. Here are two sample Java programs that do exactly the same thing according to the user. Please identify the differences in the code samples and discuss the style of each sample. Make sure to address readability as a characteristic and how it would influence an IT department's ability to maintain custom software for a corporation.

1. SAMPLE CODE A:

import java.util.Scanner;
public class DB2_SampleA{
public static void main(String args[]){
Scanner input = new Scanner(System.in);
int num1;
System.out.print("Enter first number: ");
num1 = input.nextInt();
int num2;
System.out.print("Enter second number: ");
num2 = input.nextInt();
if (num1>num2)
System.out.println("First number is bigger");
if (num1<num2)
System.out.println("Second number is bigger");
if (num1==num2)
System.out.println("Numbers are equal");
}}

2. SAMPLE CODE B:

// DB2_SampleB
// This program will get two numbers from the user
// and determine which is bigger or whether they are equal

import java.util.Scanner; // Scanner class used for getting user input

public class DB2_SampleB
{
// The manin method that begins execution of Java application
public static void main(String args[])
{
// variable declarations
int num1; // first number to compare
int num2; //second number to compare

// create Scanner to capture input from console
Scanner input = new Scanner(System.in);

// get user input, num1 and num2
System.out.print("Enter first number: ");
num1 = input.nextInt();
System.out.print("Enter second number: ");
num2 = input.nextInt();

// compare numbers and display results
if (num1 > num2)
System.out.println("First number is bigger");
if (num1 < num2)
System.out.println("Second number is bigger");
if (num1 == num2)
System.out.println("Numbers are equal");

*****Please identify the differences in the code samples and discuss the style of each sample. Make sure to address readability as a characteristic and how it would influence an IT department's ability to maintain custom software for a corporation.

© BrainMass Inc. brainmass.com October 25, 2018, 12:34 am ad1c9bdddf
https://brainmass.com/computer-science/program-execution/difference-between-two-codes-listed-below-232562

Solution Preview

Hello student,
I have completed and attached the solution for posting.

Question:
Tell the difference between the two codes listed below and answer the question listed in the details.
Details: Coding style is a very important characteristic for those entering the technology field. Here are two sample Java programs that do exactly the same thing according to the user. Please identify the differences in the code samples and discuss the style of each sample. Make sure to address readability as a characteristic and how it would influence an IT department's ability to maintain custom software for a corporation.

1. SAMPLE CODE A:

import java.util.Scanner;
public class DB2_SampleA{
public static void main(String args[]){
Scanner input = new Scanner(System.in);
int num1;
System.out.print("Enter first number: ");
num1 = input.nextInt();
int num2;
System.out.print("Enter second number: ");
num2 = input.nextInt();
if (num1>num2)
System.out.println("First number ...

Solution Summary

The difference between the two codes listed below are determined.

$2.19
See Also This Related BrainMass Solution

Similarities and Differences Between Islamic and Ethical Finance

What are the differences and similarities between ethical finance and Islamic finance?

1. I want to have knowledge of the facts and understand the related facts in a broader context about the mechanism of both ethical finance and Islamic finance, how they work.

2. I will appreciate if this is backed by more references, preferably 5 references;

3. How can I structure these ideas in an essay that have the following:

• Introduction/ Abstract
One paragraph as a condensed summary to the beginning of the paper under the title "Abstract/ Introduction"
• Literature review:
With summarized major ideas and references.
State the idea about the subject matter showing the basic theory and background about both ethical finance and Islamic finance with comparisons and contrasts.
Synthesize the ideas obtained and add some evaluation and comments.
Give more detail on the topic with formulas, numerical examples, cases from both with comparisons and contrasts.
• Arguments, formulas or examples in support of your statement
Supported arguments that pays attention to reasons, numerical examples and cases and weighs arguments in favor and against a the stated facts. Elaborate and focus numerical examples with formulas,cases comparisons, graphics and statistics that help in showing what is meant keeping in mind that the controversial subject matter which has its equivalence in the ethical and Islamic finance.
• Conclusion:
Arguments supporting the statement to balance the arguments for and against this conclusion with comparison and contrast. What precautionary measures should Islamic financial institutions take to avoid non-compliance with Sharia showing the contribution of Islamic finance to the financial system and the economy at large.
• Opinion:
It is appropriate to add an assessment or opinion.

View Full Posting Details