Problem: My problem is I can't get the output of discountRate of this code ,I am giving here the code , please solve just DiscountRate problem output.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Problem: My problem is I can't get the output of discountRate of this code ,I am giving here the code , please solve just DiscountRate problem output.

Start.java

import java.lang.*;


import java.util.Scanner;

public class Start {
public static void main(String[] args) {

{
StoryBook sb1 = new StoryBook ();

sb1.setIsbn("7th Edition");
sb1.setBookTitle("OOP JAVA");
sb1.setAuthorName("RM");
sb1.setPrice(25000.0);
sb1.setAvailableQuantity(20);
sb1.sellQuantity(3);
sb1.addQuantity(5);
StoryBook.discountRate(25.00);


System.out.println("ISBN : " + sb1.getIsbn());
System.out.println("BOOKTITLE : " + sb1.getBookTitle());
System.out.println("AUTHORNAME : " + sb1.getAuthorName());
System.out.println("PRICE : " + sb1.getPrice());
System.out.println("AVAILABLE QUANTITY : " + sb1.getAvailableQuantity());
System.out.println("Discount Rate : " + StoryBook.getDiscountRate());

 

}
}
}

StoryBook.java

 

import java.lang.*;

 

public class StoryBook {
static double discountRate;
String isbn, bookTitle, authorName, category;
int availableQuantity;
double price;

StoryBook() {
this.isbn = "";
this.bookTitle = "";
this.authorName = "";
this.availableQuantity = 0;
this.category = "";
this.price = 0.0;
}

StoryBook(String isbn, String bookTitle, String authorName, double price, int availableQuantity, String category) {
this.isbn = isbn;
this.bookTitle = bookTitle;
this.authorName = authorName;
this.price = price;
this.availableQuantity = availableQuantity;
this.category = category;
}

static void setDiscountRate(double rate) {
discountRate = rate;
}

static double getDiscountRate() {
return discountRate;
}

void setIsbn(String isbn) {
this.isbn = isbn;
}

void setBookTitle(String bookTitle) {
this.bookTitle = bookTitle;
}

void setAuthorName(String authorName) {
this.authorName = authorName;
}

void setPrice(double price) {
this.price = price;
}

void setAvailableQuantity(int availableQuantity) {
this.availableQuantity = availableQuantity;
}

void setCategory(String category) {
this.category = category;
}

String getIsbn() {
return this.isbn;
}

String getBookTitle() {
return this.bookTitle;
}

String getAuthorName() {
return this.authorName;
}

double getPrice() {
return this.price;
}

int getAvailableQuantity() {
return this.availableQuantity;
}

String getCategory() {
return this.category;
}
public void addQuantity(int amount)
{
if(amount>0)
{
availableQuantity = availableQuantity + amount;
}

else
{
System.out.println("Invalid");
}

}

public void sellQuantity(int amount)
{
if(amount>0 && amount<=availableQuantity)
{
availableQuantity = availableQuantity - amount;
}
else
{
System.out.println("Invalid");
}
}

 

void showDetails() {
System.out.println("ISBN : " + getIsbn());
System.out.println("Book Title : " + getBookTitle());
System.out.println("Author Name : " + getAuthorName());
System.out.println("Price : " + getPrice());
System.out.println("Category : " + getCategory());
System.out.println("Available Quantity : " + getAvailableQuantity());
System.out.println("Discount Rate : " + StoryBook.getDiscountRate());
}
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY