Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class _01TinySporebat26Oct15 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int health = 5800;
- int currentHelth = 0;
- String reader = scan.nextLine();
- int glowCaps = 30;
- int currentGlowCaps = 0;
- while (!reader.equals("Sporeggar")) {
- for (int i = 0; i < reader.length() - 1; i++) {
- if (reader.charAt(i) == 'L') {
- health += 200;
- }
- else {
- currentHelth += (reader.charAt(i));
- }
- }
- if ((health - currentHelth) <= 0) {
- break;
- }
- currentGlowCaps += Integer.parseInt(reader.charAt(reader.length() - 1) + "");
- reader = scan.nextLine();
- }
- if ((health - currentHelth) > 0) {
- System.out.printf("Health left: %s", health - currentHelth);
- System.out.println();
- if ((30 - currentGlowCaps) > 0 ) {
- System.out.printf("Safe in Sporeggar, but another %s Glowcaps needed.", glowCaps - currentGlowCaps);
- System.out.println();
- }
- else {
- System.out.printf("Bought the sporebat. Glowcaps left: %s", Math.abs(glowCaps - currentGlowCaps));
- System.out.println();
- }
- }
- else {
- System.out.printf("Died. Glowcaps: %s", currentGlowCaps);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement