2015-03-26 2 views
-2

Я работаю над проектом для моего класса и каждый раз, когда я пытаюсь скомпилировать я получаю следующее сообщение об ошибке в jGrasp:Jgrasp ява 26 ошибка: класс, интерфейс или перечисление ожидается

Lab 1.java:26: error: class, interface, or enum expected 
Module main() 
^ 
1 error 

Я пытался ищет ошибку в моем коде, но не могу ее найти, если кто-то видит, что не так, что я упускаю из виду это очень полезно, и я был бы признателен за любые исправления, которые избавились бы от этой ошибки. Код ниже, чтобы вы могли внимательно изучить его.

/* Проблема: Аренда Анализ, дизайн и код следующее заявление:
Это позволяет пользователю ввести арендную плату из дома и вычислить первый месяц оплаты. В первый месяц оплата включает в себя залог (равный 2-месячной арендной плате) и арендную плату за первый месяц. Просматривайте следующее: ежемесячная аренда, сумма залогового депозита и окончательный платеж.

Input 
User: 1. Rent amount 
Given: N/A 

Processing: 1. Calculate security deposit = 1 month rent * 2 
     2. Calculate total first month rent = 
      1 month rent + security deposit 

Output: 1. Price for 1 month of rent 
    2. Price of security deposit 
    3. Total for first months' rent 
*/ 

//Design 

Module main() 

//Declarations 
Declare Real oneMonthRent = 0.0//One month rent entered by user 
Declare Real securityDeposit = 0.0//2 months worth of rent 
Declare Real firstMonthRent = 0.0//Security deposit + 1 month rent 

//Input 
Set oneMonthRent = Call getRent()//user entered 

//Processing 
Set securityDeposit = Call calcDeposit(oneMonthRent)//oneMonthRent + oneMonthRent 
Set firstMonthRent = Call calcFirstMonthRent(oneMonthRent, securityDeposit)//oneMonthRent + securityDeposit 

//Output 
Call showRentAnalysis(oneMonthRent, securityDeposit, firstMonthRent)//Displays oneMonthRent, Deposit, and total first month 

End Module 

//Gets monthly rent cost from user 
Function Real getRent() 
Declare Real nRent = 0.0//local variable 

Display "Enter monthly rent " 

Input nRent 

Return nRent 
End Function 

//Calculates the Security deposit 
Function Real calcDeposit(Real noneMonthRent) 
Declare Real ndeposit = 0.0//local variable 

Set ndeposit = noneMonthRent + noneMonthRent 

Return ndeposit 
End Function 

//Calculates total first month rent 
Function Real calcFirstMonthRent(Real noneMonthRent,Real nsecurityDeposit) 
Declare Real nfirstMonthRent = 0.0//local variable 

Set nfirstMonthRent = noneMonthRent + nsecurityDeposit 

Return nfirstMonthRent 
End Function 

//Displays 1 month of rent, security deposit, and final for first month 
Module showRentAnalysis(Real noneMonthRent,Real nsecurityDeposit,Real nfirstMonthRent) 

Display "One month worth of rent cost ", noneMonthRent 
Display "Security deposit cost ", nsecurityDeposit 
Display "Total for first month of rent is ", nfirstMonthRent 
End Module 
+1

Это не очень похоже на Java код на все ... – vanza

+0

Это не Java кода. – immibis

ответ

0
public class Main { 

    public static void main(String[] args) { 
     double rent = 500.50; 
     double securityDeposit = rent*2; 
     double firstMonth = rent+securityDeposit; 

     System.out.println(firstMonth); 

    } 

} 
Смежные вопросы