473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Desktop\Inventorypart2.java:110: missing return statement

Expand|Select|Wrap|Line Numbers
  1. public class Inventorypart2 {
  2.  
  3. public static void main(String args []) {
  4.  
  5. DVD dvd;
  6.  
  7.  
  8. dvd = new DVD(1, "The Fellowship of the Ring", 5, 14.95);
  9. System.out.println(dvd);
  10.  
  11. dvd = new DVD(2, "The Chamber", 7, 12.99);
  12. System.out.println(dvd);
  13.  
  14. dvd = new DVD(3, "Superman 3", 6, 19.99);
  15. System.out.println(dvd);
  16.  
  17. dvd = new DVD(4, "Van Helsing", 3, 10.99);
  18. System.out.println(dvd);
  19.  
  20. } //end main
  21.  
  22. } // end class Inventorypart2
  23.  
  24.  
  25. class DVD {
  26. private int dvdItem;
  27. private String dvdTitle;
  28. private int dvdStock;
  29. private double dvdPrice;
  30.  
  31. public DVD(int item, String title, int stock, double price) {
  32. dvdItem = item;
  33. dvdTitle = title;
  34. dvdStock = stock;
  35. dvdPrice = price;
  36. } //end four-argument constructor
  37.  
  38. // set DVD Item
  39. public void setDvdItem(int item) {
  40. dvdItem = item;
  41. } //end method set Dvd Item
  42.  
  43. //return DVD Item
  44. public int getDvdItem() {
  45. return dvdItem;
  46. } //end method get Dvd Item
  47.  
  48. //set DVD Title
  49. public void setDvdTitle(String title) {
  50. dvdTitle = title;
  51. } //end method set Dvd Title
  52.  
  53. //return Dvd Title
  54. public String getDvdTitle() {
  55. return dvdTitle;
  56. } //end method get Dvd Title
  57.  
  58. public void setDvdStock(int stock) {
  59. dvdStock = stock;
  60. } //end method set Dvd Stock
  61.  
  62. //return dvd Stock
  63. public int getDvdStock() {
  64. return dvdStock;
  65. } //end method get Dvd Stock
  66.  
  67. public void setDvdPrice(double price) {
  68. dvdPrice = price;
  69. } //end method setdvdPrice
  70.  
  71. //return DVD Price
  72. public double getDvdPrice() {
  73. return dvdPrice;
  74. } //end method get Dvd Price
  75.  
  76. //calculate inventory value
  77. public double value() {
  78. return dvdPrice * dvdStock;
  79. } //end method value
  80.  
  81. public String toString() {
  82.  
  83. return String.format("item=%3d title=%-20s units=%d price=%.2f value=%.2f",
  84. dvdItem, dvdTitle, dvdStock, dvdPrice, value());
  85. }
  86.  
  87. } //end class DVD
  88.  
  89. class Inventory {
  90. DVD movies[] = new DVD[100];
  91.  
  92. // Add to inventory
  93. public void addToInventory(DVD movie) {
  94.  
  95.  
  96. }
  97.  
  98. // Get inventory value
  99. public double getInventoryValue() {
  100.  
  101.  
  102. Inventory myInventory = new Inventory();
  103.  
  104.  
  105. myInventory.addToInventory(new DVD(1, "Remember the Titans", 5, 14.95));
  106.  
  107. // Print out the inventory total value
  108. System.out.println("Total value of inventory is: " + myInventory.getInventoryValue());
  109.  
  110. }
  111. }
  112.  
I figured I would ask this again since noone helped me the first time...I cannot figure out how to put in the bracket without it saying reached end of file without parsing..Am I missing something?
Nov 2 '11 #1
0 1413

Sign in to post your reply or Sign up for a free account.

Similar topics

30
by: John Bailo | last post by:
The c# *return* statement has been bothering me the past few months. I don't like the fact that you can have different code paths in a method and have multiple return statements. To me, it...
3
by: Nan Li | last post by:
Hello, all, Does C/C++ ever check the return statement for a non-void function? Look at my simple code below int foo() { } int main()
8
sammyboy78
by: sammyboy78 | last post by:
I'm trying to create a class "WeeklyPay" that contains the methods that class "WeeklyPayTest" will use to compute the weekly pay of an employee when the user inputs employee name, hours worked, and...
6
KoreyAusTex
by: KoreyAusTex | last post by:
If anyone can help me figure out the what the missing return statements are, I think it might be the fact that I need to add a return false in the getValue()? import java.util.*; public class...
1
by: Annie Soomro | last post by:
Getting "missing return statement" error for following code: import java.sql.*; public class DatabaseManager{ public static int add(String user,String password)throws Exception{ ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.