IT -- Solutions Center[Forum] - Sajha Mobile
SAJHA MOBILE
IT -- Solutions Center[Forum]
Posts 182 · Viewed 76745 · Likes 29 · Go to Last Post
Ayus
· Snapshot 0
Like · Likedby · 1

Shoot out your problems...
Lets share and expand the knowledge.....!!!!



We are open to share on(any IT related stuffs) :

- Javascript/JQuery/Ajax
- Java,JSP,Servlets and Frameworks
- WebServices
- Unix, Linux, Webserver Administration


+ many more !!!!
Load Previous
UNIX_geek
· Snapshot 4474
Like · Liked by · 0
Folks,

Glad to know at least you tried once. This steps is pretty straight forward. It works for me couple of years ago.
Please just give a shot and let me know where you stuck.
Note. To do this you must have basic knowledge of networking, Dynamic Host Configuration Protocol and Domain Name System.
If not i will walk you through so no worries.

http://www.linuxhomenetworking.com/

Thanks,

Unix_Geek
nepali8
· Snapshot 4498
Like · Liked by · 0
 program that calculates and displays the average number of days a company’s employees are absent. The program should have the following functions:

· A function called by main that asks the user for the number of employees in the company. This value should be entered (and returned) as an int. It has no arguments.

· A function called by main that accepts one argument, the number of employees in the company. It should ask the user to enter the number of days each employee missed during the past year. The total of these days should be returned as an int.

· A function called by main that takes two arguments, the number of employees in the company and the total number of days absent for all employees during the year. The function should return as a double, the average number of days absent. (This function does not perform screen output and does not ask the user for input).

Input validation: Do not accept a number less than 1 for the number of employees. Do not accept a negative number for the days any employee missed.

so far,
#include <iostream>
#include <iomanip>
using namespace std;
 
 
void Employee();
void Absents();
double AvgAbsents(int, int);
int main()
{
int nEmployees = 0;
int nTotalAbsents = 0;
double dAvgAbsents = 0.0;
 
nEmployees = Employee();
nTotalAbsents = Absents();
 
dAvgAbsents = AvgAbsents(nEmployees, nTotalAbsents );
 
cout << "The average days missed is " << dAvgAbsents <<endl;
return 0;
}
 
int getEmployees()
{
int n = 0;
cout <<"Enter the Number of Employees: ";
cin >> n, &n;
return n;
}
 
int getAbsents(int nEmployees)
{
int sum =0;
int n = 0;
int i;
for (i = 0; i < nEmployees; i ++)
{
cout <<"Enter the days ansent: ";
cin >>n , &n;
sum += n;
}
return sum;
}
 
double getAvgAbsents(int nEmployees, int nAbsences)
{
double avg =0.0;
if(nEmployees>0)
avg = (double)nAbsences/(double)nEmployees;
return avg ;
}
 
error i got.
 
6 10\6 10\6.cpp(15) : error C2440: '=' : cannot convert from 'void' to 'int'
6 10\6 10\6.cpp(16) : error C2440: '=' : cannot convert from 'void' to 'int'
 
Thanks in advance
nepali8
· Snapshot 4500
Like · Liked by · 0
 Hey guys!!

i have got one error solved. i need to solve;

A function called by main that asks the user for the number of employees in the company. This value should be entered (and returned) as an int. It has no arguments.

which i did

void Employee();
 
AND  in main function, i simply call the function like this
nEmployees = Employee();

but it keep on say this error,
 
6 10\6 10\6.cpp(15) : error C2440: '=' : cannot convert from 'void' to 'int'

any suggestion?
 

Ayus
· Snapshot 4513
Like · Liked by · 0
 @nepali8

if your method type is void it doesnt return you anything. May be compiler is expecting int and you are calling void. Its a complete data type mismatch. 

call getEmployees() function. This function is returning int.

Your getEmployees() function has code to get user input, why are you calling void Employee().

-- i am not C# programmer, but it just might help.---
nepali8
· Snapshot 4536
Like · Liked by · 0
hello!!

I need some heads up on this.
calling all programmer!!!!
 
                                                                                            Bank system.

There are 4 kinds of accounts:

 

 

Saving

Checking

CD

Mortgage

Data

ID

Name

Balance

Interest rate

Minimum requirement

 

ID

Name

Balance

Monthly fee

ID

Name

Balance

Term

Expire date

Interest rate

ID

Name

Balance

Interest rate

Term

Operations

Display info

Deposit cash

Transfer to checking, mortgage account

Interest calculation for current month

Display info

Deposit cash

Transfer to saving, mortgage account

Display info

Create CD

Cancel CD and move money to saving or checking account

Display info

Deposit cash

General operations

Display all account information of one customer

Calculate overall balance of one customer

 

 

 

 

 

When the program starts, initialize several accounts for testing. Provide menu like interface to enable all supported actions (in menu, ask user for account ID to determine the operating account). 

Thanks in advance!!
Ayus
· Snapshot 4579
Like · Liked by · 0
@namaste8
- its on java
- i have only done for Checking class
- and tested the class
- similary create two other classes
- operations should be function name(method name)
- for balance transfter: call the method of mortgage or saving class and pass the amount to saving class method  from checking class and vice versa.
- to determine the account via ID, do you hardcore, use arraylist or database. its not clear. for simplicity, you can hardcode in the beginning.

public class Checking {
  private String ID;
  private String name;
  private double balance;
  private double monthlyFee;
  private double amount;

    public String getID() {
        return ID;
    }

    public void setID(String ID) {
        this.ID = ID;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double getMonthlyFee() {
        return monthlyFee;
    }

    public void setMonthlyFee(double monthlyFee) {
        this.monthlyFee = monthlyFee;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String displayInfo(){
        return ("ID:\t"+getID()+"\n"+"Balance:\t"+getBalance()+"\n"+"Name:\t"+getName()+"\n"+"Monthly Fee:\t"+getMonthlyFee());
    }
    public void depositCash(double amount){
        if(amount >0){
          amount = amount+getBalance();
          this.amount=amount;
       }
    }
    public double getNewBalance(){
     return amount;
    }

}

//initialize the class

public class TestClass {
  public static void main(String[]args){
  Saving s = new Saving();
  s.setID("1abc");
  s.setBalance(2000.00);
  s.setName("Test");
  s.setMonthlyFee(20.00);
  s.depositCash(1000);
  System.out.println("Information:\t"+s.displayInfo());
  System.out.println("New Balance:\t"+s.getNewBalance());

  }
}


Last edited: 03-May-11 02:45 PM
pichas
· Snapshot 4583
Like · Liked by · 1
How do I hack sajha?
;)
bange
· Snapshot 4607
Like · Liked by · 0
@nepali8
 I would use abstract class since most of the members and methods are common




bange
· Snapshot 4631
Like · Liked by · 0
Baaki afai garnu kere,

/**
 *
 * @author bange
 *
 */
abstract class Account
{
    private int id;
    private String name;
    private double balance;
    
    public int getId()
    {
        return id;
    }
    public void setId(int id)
    {
        this.id = id;
    }
    public String getName()
    {
        return name;
    }
    public void setName(String name)
    {
        this.name = name;
    }
    public double getBalance()
    {
        return balance;
    }
    
    public void setBalance(double balance)
    {
        this.balance = balance;
    }
    abstract void displayInfo();
    
    void depositCash(double cash)
    {
        balance += cash;
    }
    void transferTo(Account account, double amount)
    {
        account.setBalance(account.getBalance() + amount);
        balance = balance - amount;
    }

}
 class Saving extends Account
{
    private float interestRate;
    private double minimumReq;

    public float getInterestRate()
    {
        return interestRate;
    }

    public void setInterestRate(float interestRate)
    {
        this.interestRate = interestRate;
    }

    public double getMinimumReq()
    {
        return minimumReq;
    }

    public void setMinimumReq(double minimumReq)
    {
        this.minimumReq = minimumReq;
    }
    void calcuateInterest()
    {
        System.out.println(getBalance()*interestRate/1200); // PTR/100 ho? :D
    }
    
    void displayInfo()
    {
        // Enter desired info
        System.out.println("Account type=Saving Id= " + getId() + " Name"  + getName() + "Balance " + getBalance());
    }
}

 class Checking extends Account
{
    private float monthlyFee;
   
    public float getMonthlyFee()
    {
        return monthlyFee;
    }

    public void setMonthlyFee(float monthlyFee)
    {
        this.monthlyFee = monthlyFee;
    }
    
    void displayInfo()
    {
        // Enter desired info
        System.out.println("Account type=Checking Id= " + getId() + " Name "  + getName() + "Balance " + getBalance());
    }
}

public class test
{
  public static void main(String args[])
  {
    Saving savAcc = new Saving();
    savAcc.setId(1);
    savAcc.setName("ram");
    savAcc.setBalance(20000.12);
    Checking checkAcc = new Checking();
    checkAcc.setId(1);
    checkAcc.setName("ram");
    checkAcc.setBalance(3000);
    checkAcc.transferTo(savAcc, 200);
    savAcc.displayInfo();
    checkAcc.displayInfo();
  }
}

o/p chai yasto aayecha:
Account type=Saving Id= 1 NameramBalance 20200.12
Account type=Checking Id= 1 NameramBalance 2800.0
nyshangal
· Snapshot 4722
Like · Liked by · 0
I have two pages. say abc and xyz.

page abc has a anchor tag say "test" , when i click on test, is there a way that I can target a div in page xyz. I cannot use [Disallowed String for - i frame not allowed]

i tried <a href="xyz.jsp" target="div1"> test</a>


and around that div in second page
i gave
<a name="div1> <div >

Please suggest
default061
· Snapshot 4753
Like · Liked by · 0
Are you trying to open/load  div1 from xyz in abc? ( and anchor is in abc rt?)

I dont have answers for your question, but some alternatives may be helpful.

you can try using  directives for the content of div and use logic tag to determine which content you want to include.

Or you can create a template and reload with new contents.

If you use struts, you can use tiles and define that section to be dyanmic .




nyshangal
· Snapshot 4776
Like · Liked by · 0
no i am not trying to load div from xyz in abc..

when a link in abc is clicked  xyz is loaded, xyz has multiple divs..

and my  problem is that I have to target one particular div in the page xyz...
the xyz should load , but the page should scroll enough to show that div first
:(

how do i do it...can i do using js?
default061
· Snapshot 4780
Like · Liked by · 0
you may find this link worth for reading.

http://www.frihost.com/forums/vt-47880.html
nepali8
· Snapshot 4800
Like · Liked by · 0
Namaste!!!
How u'll doing. Need some information. What kind jobs perspective is out there for who doing his or her double bacholars degree in computer scinece and business adminstration. Or lets just put i like this
way, if one already completed his 1st degree in business managemnt and if
he wants do his second degree in ITfield, which field will be better?





Your valuable informatiom will be highly appriciate
nepali8
· Snapshot 4812
Like · Liked by · 0
Basically im pointing on either computer science or information technology?
Ayus
· Snapshot 4816
Like · Liked by · 0
@nyshangal

 http://www.yourhtmlsource.com/text/internallinks.html


Last edited: 07-May-11 08:11 PM
nyshangal
· Snapshot 4828
Like · Liked by · 0
 thank you guys, it was not a same page link, it was two different page without using an [Disallowed String for - i frame not allowed]


i found the answer though, we can actually give id with the url 

<a href="xyz#div"> 
:)

and it solved my problem 
Ayus
· Snapshot 4858
Like · Liked by · 0
yeah and it was in the link above.
nyshangal
· Snapshot 4886
Like · Liked by · 0
yeah :)
Ayus
· Snapshot 5623
Like · Liked by · 0
any guys ever used lucene for suggest search???
Please log in to reply to this post

You can also log in using your Facebook
View in Desktop
What people are reading
You might like these other discussions...
· Posts 9 · Viewed 12545 · Likes 1
· Posts 7 · Viewed 3931 · Likes 1
· Posts 1 · Viewed 1085
· Posts 1 · Viewed 1060
· Posts 1 · Viewed 970
· Posts 1 · Viewed 1064
· Posts 1 · Viewed 1036
· Posts 21 · Viewed 9911 · Likes 1
· Posts 3 · Viewed 2549
· Posts 5 · Viewed 7758 · Likes 1



Your Banner Here
Travel Partners
Travel House Nepal