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

  What security problems does this present

The police and the public defender share a computer. What security problems does this present? Do you feel it is a reasonable cost-saving measure to have all public agencies share the same (set of) computers?

  Write a program with main() method that tests the examgrade

Create a new student with valid first/last name, invalid id, and valid status.

  Supply chain with retail stores

Is a direct supply chain without retail stores always less expensive than a supply chain with retail stores?

  Purpose of the logical network perimeter mechanism

Describe the purpose of the logical network perimeter mechanism and how it establishes a logical boundary. Further, list the components commonly used to create a logical network perimeter. How does this get implemented? Find a company who uses it..

  Discuss case of magazine-subscription telemarketing company

Computers in Telemarketing Your team is performing IT research for a ­magazine-subscription telemarketing company. The company's 150 telemarketers must make.

  What are sexist stereotypes

What are sexist stereotypes? What are some common stereotypes about women that you can think of?

  Determine the average size of the cost matrices

Write a program for solving the assignment problem by the branch-and-bound algorithm. Experiment with your program to determine the average size of the cost matrices for which the problem is solved in a given amount of time, say, 1 minute on your ..

  User for the values of the equation coefficient

Finding integral of a function is finding the area under the curve of the function over a certain range. Create a script that will find the area of a quadratic

  Find prime numbersless than or equal natural numbers

Find the prime numbersless than or equal to the following natural numbers.

  Exceeding the number of bytes being captured

What are some causes of the number of bytes on the wire exceeding the number of bytes being captured?

  What is the p-t ratio of the measurement

The specifications are 150 to 200 um. If k = 6, what is the P/T ratio of the measurement? Please show the formula/steps taken to receive the answer.

  What is the sum for this number of terms

Use a while loop to determine how many terms in the series 2k, k = 1, 2, 3, . . . , are required for the sum of the terms to exceed 2000. What is the sum for this number of terms?

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