- package com3;
- public class CellPhoneDemo {
- public static void main(String[] args) {
- Cell[] cells = new Cell[5];
- cells[0] = new Cell(1,"aaa",50,0.5,"mum");
- cells[1] = new Cell(2,"aaa",40,0.5,"ahd");
- cells[2] = new Cell(3,"aaa",30,0.5,"pne");
- cells[3] = new Cell(4,"aaa",55,0.5,"mum");
- cells[4] = new Cell(5,"aaa",60,0.5,"pne");
- System.out.println(deductBalance(cells[0],10));
- Cell[] newCells = searchCircle(cells,"mum");
- for(Cell cell:newCells)
- {
- System.out.println(cell.getCellNo());
- }
- }
- public static double deductBalance(Cell cell, int seconds) {
- double oldBalance = cell.getBalance();
- double newBalance = oldBalance - (cell.getRatePerSecond()*seconds);
- return newBalance;
- }
- public static Cell[] searchCircle(Cell[] cells, String circlename) {
- int i = 0;
- Cell[] newArray = new Cell[2];
- for (Cell c: cells) {
- if(c.getCircle()==circlename) {
- newArray[i] = c;
- i++;
- }
- }
- return newArray;
- }
- }
[text] tyu
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new:
File Description
- tyu
- Paste Code
- 16 Sep-2019
- 989 Bytes
You can Share it:
Latest Code Pastes