Translate the pseudocode in the text into java

Assignment Help Basic Computer Science
Reference no: EM132336798

Question

Translate the pseudocode in the text into Java and insert the proper code after each comment in BookClub.java. You should be able to compile the code without error and run it with correct results.

How does my java code look? If there are any errors please let me know whats wrong.

import java.util.Scanner;

class BookClub

{

public static void main (String[] args)

{

// Creat a Scanner object for keyboard input

Scanner keyboard = new Scanner(System.in);

//Delcare variables here

int bookNumber;

//Prompt the user and get the number of books from user

System.out.print("Enter the number of books want to purchase? ");

bookNumber=keyboard.nextInt();

//Use a selection control to determine the number of books purchased

if(bookNumber<0){

// and display the proper message

System.out.println("Cannot buy a negative number of books.");

}

else{

System.out.println("Purchased "+bookNumber+" number of books.");

}

} // end main()

} //end class

Reference no: EM132336798

Questions Cloud

Digital communication applications using matlab : Understand the importance of multiuser resource allocation techniques employed in the uplink of modern digital communication networks using wireless medium
Discuss the relationship between data and knowledge : Discuss the relationship between data, information, and knowledge. Support your discussion with at least 3 academically reviewed articles.
Identify the name of the wizard : Choose a design wizard; write observations below as you work through the process of using it to prepare for the initial post.
Implement the spell checker and the hash table : Using classes SpellChecker and HashTable to implement the spell checker and the hash table, respectively
Translate the pseudocode in the text into java : You should be able to compile the code without error and run it with correct results.
Discuss how genetic engineering may impact field of nursing : Discuss how genetic engineering may impact the field of Nursing. Discuss how genetic engineering may impact the protocol of care within the field of Nursing.
Discuss the different types of muscle fibers : Did your research discuss the different types of muscle fibers that develop with different types of training and why this is so?
Write on Neonatal Mortality for India and USA : Select ONE health condition from list below and compare disparities in health outcomes. Write on Neonatal Mortality for India and USA
What is the chance of success on the first attempt : THE MEDIUM ACCESS CONTROL SUBLAYER- Computer Networks for HND RQF Level-What is the probability of exactly k collisions and then a success?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  General types of network topologies

PAN, LAN, Wireless LAN, MAN, and WAN are all general types of network topologies. Pick two (2) of these and, in 200 or more of your own words

  Determine the value produced at the primary output

For each of the four possible combinations of inputs applied to the two primary inputs of this circuit, determine the value produced at the primary output. Is there a simpler circuit that gives the same input/output behavior?

  What is the difference between turn and roll

What is the difference between turn and roll? What difference does it make if you change the order of instructions in a particular world? When you are finished, click Tools on the menu bar, and then click World Statistics to see how long your Alic..

  Existing manual business functional-based transaction proces

DEFINE and DISCUSS the steps taken from an existing manual business functional-based transaction process to an improved, integrated, automated transactional.

  Describe what fraud is and how it could be conducted

In conversations with PVSS, you have talked about the long-term strategic goals and plans for expansion.

  Does the configuration become an oscillator

Implement a new version of the gameoflife.py program to use your SparseLifeGrid class from the previous question.

  Number of opportunities for women in leadership

Suggest three (3) ways that diversity can increase the number of opportunities for women in leadership. Next, analyze the significance

  Explanation of how technology might help you reach your goal

explanation of how technology might help you reach your goals

  The market for caviar depends on the weather

The market for caviar depends on the weather. If the weather is good, the caviarsells form $30 and if the weather is bad, it sells for $20. Caviar produced one weekwill not keep until the next week. The caviar producer's cost function is given by

  Methods for first and second elements of pair

Write a generic class Pair which has 2 type parameters, F and S, representing the type of the first and second elements of a pair respectively. Add get and set methods for the first and second elements of the pair.

  Express the following conditions about the cost of implement

It is better to use index-scan with a non clustering index on x and a term that equates x to a constant than a clustering index on y and a term of the form y > C for some constant C.

  Prompts the user to enter a number within an input box

Prompts the user to enter a number within an Input Box Reads in the value entered by the user

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