Identify the differences in the code samples and discuss it

Assignment Help Operating System
Reference no: EM13943182

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.

Reference no: EM13943182

Questions Cloud

Provide a current example of a compelling news story : After studying the assigned reading 21st Century Communication: A Reference Handbook: Chapter 65: The Changing Nature of "News" considering the concepts of timeliness, proximity, unusualness, prominence, impact, conflict and human interest, provid..
Determine pounds of quicklime and soda ash : A lime-soda softening plant treats a flow of 150 MGD, and the water has 86mg/l Ca2+, 35 mg/L Mg2+, 299 mg/L HCO3- and 6mg/l CO2. The commercial grade of quicklime has a purity of 85% and the soda ash has a purity of 95%. Determine the pounds of qu..
Many projects use a resource that the company already owns : Many projects use a resource that the company already owns. When evaluating a capital budgeting decision, we generally include interest expense. Only include as incremental expenses in your capital budgeting analysis the additional overhead expenses ..
Determining the incremental earnings of a project : We begin the capital budgeting process by determining the incremental earnings of a project. The marginal corporate tax rate is the tax rate the firm will pay on an incremental dollar of pretax income. Investments in plant, property, and equipment ar..
Identify the differences in the code samples and discuss it : 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.
Aspects of the projects keeping in mind : What project management tools would you use to implement and monitor all aspects of the projects keeping in mind - Anti-discrimination
What is a durable power of attorney : What is a Durable Power of Attorney? Find an example of the basic terms and submit with your explanation.
What is the projects annual cash flow for year three : You must evaluate a proposal to buy a new milling machine. the base price is $108,000, and shipping and installation costs would add another $12,500. The machine falls into the MACRS 3-year class, and it would be sold after 3 years for $65,000. What ..
Environmental challenges in australia : Imagine you have the role of Administration Officer, Environmental Challenges Australia Ltd. You have been asked to plan, draft, review and write a final copy of fully blocked style letter to Southern Office Furniture Pty Ltd asking for their curr..

Reviews

Write a Review

Operating System Questions & Answers

  Question about backbone structure

Suppose you have been hired by a mail order firm to install a backbone structure that will connect four LANs and provide a connection to the Internet.

  A machine has a 32-bit address space and an 4-kb page

A machine has a 32-bit address space and an 4-KB page. Suppose a simple OS just boot up on the machine, running a single process. The process uses 2 memory pages for the text and data memory (combined) near the lowest virtual address, and 1 memory pa..

  Many people would like to have their own business if you

many people would like to have their own business. if you were to start your own small business why would you take on

  Explaining first-in-first-out scheduling

Qqueue for service (if the server process is busy servicing another request). Requests in queue are served according to the scheduling policy in use: First-In-First-Out (FIFO) scheduling.

  Explain basic network security concepts

Explain an example of the Public Key Infrastructure that would describe the differing usages of symmetric and asymmetric encryption and how these encryption technique might use either a substitution or a transposition cipher.

  What is the predication about of the next run time?

1). An aging algorithm with a = 1/2 is used to predict run times. The previous four runs, from oldest to most recent, are 30, 10, 20, 40 msec. what is the predication about of the next run time? You may use regular arithmetic or binary with bit shift..

  What are the four types of business ownership describe each

what are the four types of business ownership? describe each of them. your response should be at least 200 words in

  Write down the reference string if page size is given

Consider following sequence of memory references from 460-byte program: 10, 11, 104, 170, 73, 309, 185, 245, 246, 434, 458, 364. Write down the reference string, assuming page size of 100 bytes.

  Create a use case diagram, an activity diagram

Alfred requests that Calvin accept the first body, Calvin agrees, and the first body arrives. Calvin starts welding it and promises Alfred to notify him when it is ready for the next body.

  Compute number of disk tracks traversed by using fcfs-sstf

Compute number of disk tracks traversed by using FCFS, SSTF, SCAN, and LOOK algorithms for series of disk track service request given below.

  Create a new file called week3prog3

Linux® Script 3 Requirements In the same folder as last week, create a new file called week3prog3[name].scr. Change the permissions on this new file to add the execute bit for user, group, and owner

  In this discussion locate two different operating systems

multitudes of file systems exist across the numerous operating systems that have been developed. in this discussion

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd