JAVA
The extra credit assignment is to create a text-based, turn-based Space Invaders style game.
The game board is 6 wide by 10 high, though really it could be wider but that would make the game harder.
You type ‘f’ into the console to fire. This destroys all enemy ships in the column that the player is currently in.
To move you type ‘m’ followed by the number of the column to move to that column. For example if you want to move to the second column you type in “m 2”.
Each round the space invaders move down toward the ground. For each one that hits the ground you lose a life.
Expert Answer
// Question seems to be incomplete.
package test;
/**
*
* @author Abhishek
*/
import java.io.*;
import java.util.Scanner;
public class test {
public static void main(String []args)
{
Scanner sc = new Scanner(System.in);
int c=0,score=0,life=3;
while(life>0)
{
String input = sc.nextLine();
if(input.equals(“f”))
{–life;
score+= 10;}
else
c= input.charAt(2)-‘0’;
}
System.out.println(“Game Over!!! Score: “+score);
}
}